Skip to content

promote CSS @import to file attachment #474

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

mbostock
Copy link
Member

This detects @import rules in stylesheets, promotes them to file attachments, and rewrites paths in the same way that we rewrite <link> element href attributes.

This also adds resolution for the built-in CSS modules such as observablehq:theme-light.css, giving a bit more flexibility in how themes are specified. For example, you can now say:

<style>

@import url("observablehq:theme-light.css");

</style>

TODO:

  • Parse and rewrite transitive CSS imports, too
  • When a built-in CSS module is imported, include it in the build

Fixes #416, eventually. And should help with #415.

@mbostock mbostock requested a review from Fil January 10, 2024 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detect and follow CSS @import directives
2 participants