Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS not injected #17

Open
Chrisdo82 opened this issue Nov 5, 2021 · 3 comments
Open

CSS not injected #17

Chrisdo82 opened this issue Nov 5, 2021 · 3 comments

Comments

@Chrisdo82
Copy link

Hi, I have a custom css file imported for my components. It seems that they get ignored when I register the component as a web component. How can I inject it into the web component?

@kopach
Copy link
Collaborator

kopach commented Dec 6, 2021

Hi @Chrisdo82, thanks for using this lib and your contribution. Could you, please, provide a working example showing your issue in, e.g., https://codesandbox.io or similar?
Also note, if build your React components using CRA scripts (or similar way), CSS defined with styles property of component might be extracted into separate *css files, make sure to include them into your destination app.
As alternative — use https://styled-components.com/ library, which works great with current lib as it doesn't extract CSS separately but keeps it bundled within *.js file.

@kopach kopach assigned kopach and unassigned kopach Dec 6, 2021
@jun4rui
Copy link

jun4rui commented May 11, 2022

Hi, I have a custom css file imported for my components. It seems that they get ignored when I register the component as a web component. How can I inject it into the web component?

hi bro, i think you can set the web component to element so the css will take effect

Below is a demo of the code, it is not documented in readme.md

//Add a third hidden parameter to registerAsWebComponent
registerAsWebComponent(App,'webc-footer','element')

The third parameter can be:
'' (default), shadow dom close
'open', shadow dom open
'element', no shadow dom

@Vulwsztyn
Copy link

Thanks @jun4rui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants