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

Inject CSS into Shadow root after initialisation #35

Open
reformatco opened this issue Aug 21, 2024 · 2 comments
Open

Inject CSS into Shadow root after initialisation #35

reformatco opened this issue Aug 21, 2024 · 2 comments

Comments

@reformatco
Copy link

I am making a feed widget that a client can embed on external websites. I am loading sanitized CSS from an API after initialisation and need to be able to inject the CSS into the shadow root but when i try this.$el.shadowRoot.appendChild i get errors.

How can I inject styles after initialisation? Any help would be much appreciated.

@EranGrin
Copy link
Owner

I'll be back from holiday in 15days, but in generally injecting the css into the shadow DOM can be done via the cssFrameworkStyles.
The only limitation is with the css vars, that need to be attached to the host and not to the root, and I will try to push this feature to the next version

@reformatco
Copy link
Author

Thanks @EranGrin i've found they've added a shadowRoot() function to core but it can only be called inside setup() within defineCustomElement so not sure how helpful that might be

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

2 participants