vue-web-component-wrapper icon indicating copy to clipboard operation
vue-web-component-wrapper copied to clipboard

Inject CSS into Shadow root after initialisation

Open reformatco opened this issue 1 year ago • 2 comments

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.

reformatco avatar Aug 21 '24 14:08 reformatco

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

EranGrin avatar Aug 22 '24 06:08 EranGrin

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

reformatco avatar Aug 23 '24 15:08 reformatco

@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

EranGrin avatar Nov 13 '24 08:11 EranGrin

feature is available in the latest version

EranGrin avatar Dec 16 '24 22:12 EranGrin