← Back to release summary

Style Module Imports via Link Elements

Category
DOM
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

Introduces a variation of `<link rel=stylesheet>` that utilizes the module map and shares CSSStyleSheet instances between shadow roots. Allows developers to use existing features available in Javascript (such as the module map and import maps) with declarative HTML.

Motivation

Without this feature, developers have several non-ideal options for sharing a set of styles between declarative shadow DOM hosts: 1. Use imperative CSS Modules, somewhat defeating the purpose of declarative shadow DOM, because it requires script and must happen after the declarative shadow DOM has been parsed. 2. Duplicating <style> tags, resulting in more work for parser and more work for the developer to update dynamically. 3. Use external CSS files in a <link> tag, resulting in a potential Flash of Unstyled Content (FOUC), as well as more work for the developer to update dynamically.

Standards & signals

Ecosystem

Explainers: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/LinkTagModuleImport/explainer.md

View on chromestatus.com