stencil
stencil copied to clipboard
Feature request: allow the use of a stylesheet as `adoptedStylesheets` in component libraries
Stencil version:
@stencil/[email protected]
I'm submitting a:
[ ] bug report [x] feature request [ ] support request
Current behaviour: Context: I'm working on a web component library.
Stencil allow the inclusion of globalStyles
in the stencil.config.ts
, which then is included in the dist after compilation. While this stylesheet is useful, a very common need in component libraries would be to be able to set some rules globally for all components (think fonts, reset.css, box-sizing: border-box
, etc.).
Right now, the way to do it would be either to:
- manually include the global stylesheet in all components of the library, which means that all components will now include the stylesheet itself which in turn can cause a very quick augmentation of the bundle size.
- manually configure a Constructable Stylesheet system, in order to make all your components adopt the stylesheet.
The second option seems better, and I feel that Stencil could handle this at build time instead of letting the developers implement a custom solution 😄
Hey, are there any plans to include this feature? @JMDidon did you manage to implement a custom soltuion that you can share?:)
@christophsaile thanks for nudging on this issue. I've updated the label for it which slots it into our bucket of community features we consider to include in future roadmaps. Please subscribe to this issue to receive updates.
Hey @christophsaile!
I changed company kinda recently and haven't seen your message until today 😅 Basically we haven't worked on it as there were other prios, and as we had decided to drop support for ShadowDOM for accessibility reasons this feature lost a bit of its purpose to us.
Still, I think being able to declare an adoptedStylesheet
for a component library would be very useful 🙂