Skip to content

Feature request: allow the use of a stylesheet as adoptedStylesheets in component libraries #1967

@JMDidon

Description

@JMDidon

Stencil version:

 @stencil/core@1.7.4

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 😄

Metadata

Metadata

Labels

Feature: Want this? Upvote it!This PR or Issue may be a great consideration for a future idea.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions