EranGrin / vue-web-component-wrapper

vue3 - web component wrapper plugin
https://erangrin.github.io/vue-web-component-wrapper/
60 stars 8 forks source link

Inject CSS into Shadow root after initialisation #35

Open reformatco opened 3 months ago

reformatco commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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

EranGrin commented 1 week ago

@reformatco can we close this issue ?

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

This feature is available in the latest version