Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add style sheet module scripts #4423

Closed
wants to merge 1 commit into from

Conversation

littledan
Copy link
Contributor

@littledan littledan commented Mar 8, 2019

This patch provides CSS modules as a single default export, of
a CSSStyleSheet object, which is not added to the document.

Edge cases which I didn't see discussed elsewhere:

  • @imports are recursively fetched together with the module graph,
    blocking script execution. Network errors reached prevent the
    execution of the entire module graph.
  • Any MIME type whose essence is "text/css" is accepted; this appears
    to be weaker checking than elsewhere in the specification.
  • Although the Constructable Stylesheet Objects proposal is used for
    infrastructure, the resulting CSSStyleSheet object acts as if it
    were not constructed (i.e., you can't call the replace() method).

Note, the Constructable Stylesheet Objects proposal makes important steps
to specifying loading of @import, but there may still be room for more
precise plumbing with HTML. This text ensures that style sheet module scripts
have a base URL and fetch options, which might be referenced by the definition
of @import in the future.

Closes #4315
Closes WICG/webcomponents#759


/infrastructure.html ( diff )
/references.html ( diff )
/scripting.html ( diff )
/webappapis.html ( diff )

@domenic
Copy link
Member

domenic commented Mar 8, 2019

Very cool. I think ultimately this will be blocked on fixing the foundations of the @import specification; those are just too shaky to build a feature like this on. I know @domfarolino was looking in to that a bit. But, the general approach makes sense.

@annevk annevk added addition/proposal New features or enhancements topic: style labels Mar 11, 2019
@Ms2ger Ms2ger force-pushed the css-modules branch 2 times, most recently from 379b29a to 5ebee9b Compare May 21, 2019 09:38
This patch provides CSS modules as a single default export, of
a CSSStyleSheet object, which is not added to the document.

Edge cases which I didn't see discussed elsewhere:
- @imports are recursively fetched together with the module graph,
  blocking script execution. Network errors reached prevent the
  execution of the entire module graph.
- Any MIME type whose essence is "text/css" is accepted; this appears
  to be weaker checking than elsewhere in the specification.
- Although the Constructable Stylesheet Objects proposal is used for
  infrastructure, the resulting CSSStyleSheet object acts as if it
  were not constructed (i.e., you can't call the replace() method).

Note, the Constructable Stylesheet Objects proposal makes important steps
to specifying loading of @import, but there may still be room for more
precise plumbing with HTML. This text ensures that style sheet module scripts
have a base URL and fetch options, which might be referenced by the definition
of @import in the future.

Closes WICG/webcomponents#759
@annevk
Copy link
Member

annevk commented Sep 28, 2019

Closing per discussion in #4898 (adds the same thing).

@annevk annevk closed this Sep 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements topic: style
Development

Successfully merging this pull request may close these issues.

JSON modules Cascading Style Sheet module scripts
3 participants