-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
focus-area-proposalFocus Area ProposalFocus Area Proposal
Description
Description
CSS Module Scripts allow JavaScript modules to import style sheets. They can then be applied to a document or shadow root using adoptedStyleSheets in the same way as constructible style sheets.
Not currently available cross browser (Safari) effecting adoption.
Rationale
- CSS modules will allow styles to be loaded in component definitions without adding <style> or elements that need to be created in each element instance.
- Authors today often use inlined CSS strings in JS modules, but many of them want to move the CSS into separate .css files.
- Without CSS-in-JS it's difficult to ensure that CSS is loaded before the component is defined and rendered. CSS module scripts provide the same ordering guarantee.
- Component authors may need to import a resource that is only available as an external .css file, and don't have control over the resource to wrap it in a JS module.
Specification
https://github.com/tc39/proposal-import-assertions
Tests
abdonrd, otabekshoyimov, davidkudera, bennypowers, patak-dev and 4 more
Metadata
Metadata
Assignees
Labels
focus-area-proposalFocus Area ProposalFocus Area Proposal