Skip to content

CSS Module Scripts #1466

Open
Open

Description

@dandclark

Description

CSS module scripts allow a CSS file to be imported as a constructable stylesheet using the JavaScript module import syntax:

import styleSheet from "./styles.css" with { type: "css" };
documentOrStyleSheet.adoptedStyleSheets = [styleSheet];

Shipped in Chromium and Gecko, not in WebKit.

Specification

https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-css-module-script

web-feature

https://web-platform-dx.github.io/web-features-explorer/features/css-modules/

Test Links

https://wpt.fyi/results/html/semantics/scripting-1/the-script-element/css-module

Additional Signals

This has been proposed 4 times for prior versions of Interop (once by me, 3 times by others):
2026: #1056
2025: #703
2024: #597
2023: #206
Lots of positive reactions on those threads (and negative reactions to the rejections) in the past couple years.

Activity

  1. github-actions commented on Sep 23, 2026

    @github-actions

    This comment was automatically generated based on the information you provided. Please don't edit it.

    Below is additional information about the web feature (from the web-features project) which is referenced in your proposal.
    If this doesn't accurately correspond to your proposal, please update your initial comment to include web-features: <feature-id>.
    To find feature IDs, use the web-features explorer.

    Feature CSS import attributes

    • ID: css-modules
    • Name: CSS import attributes
    • Description: Module import … with { type: "css" } statements load CSS modules as constructable stylesheets. Also known as CSS module scripts.
    • Baseline status: Limited Availability
    • Docs: import
    • Standard positions: Mozilla (positive), WebKit (support)
    • Developer signals: 45 votes (details)
    • Chrome use counter: chromestatus.com (~0.002% of page loads)
    • WPT tests: wpt.fyi results
    • More information: See the web-features explorer
  2. justinfagnani commented on Sep 25, 2026

    @justinfagnani

    WebKit has a PR open for support: WebKit/WebKit#72110

  3. klebba commented on Sep 25, 2026

    @klebba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    focus-area-proposal

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions