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

@import not allowed in constructed stylesheets #1

Closed
kealjones-wk opened this issue Aug 11, 2020 · 1 comment
Closed

@import not allowed in constructed stylesheets #1

kealjones-wk opened this issue Aug 11, 2020 · 1 comment

Comments

@kealjones-wk
Copy link
Contributor

Sorry if this issue is already known, I tried to use style-shelter, and chrome spat out this warning:

@import rules are not allowed here. See WICG/construct-stylesheets#119 (comment).

Unfortunately, in that discussion it basically surmises that using @import in constructed style sheets is not supported in any way now... obviously, that was the main way that style-shelter worked.

Have you heard about this?

Are there any ideas or plans for alternative implementations?

@bengfarrell
Copy link
Owner

Hey thanks for the note! TBH, I haven't been using this project at all because I've been going through LitElement which does some nice things with CSS and Constructed Stylesheets under the hood. I'm mostly dealing with CSS in template literals in JS these days, or a front end tooling task that takes real CSS and wraps it as the aforementioned template literal.

That said, it's a bummer that @import rules aren't allowed anymore. That's news to me. I did have an idea that I think panned out, which is to use fetch to load the text of the CSS asynchronously just like @import was doing. I just checked in the change to this repo, along with some edits to the README and demo.html and demo.css to show it off as a proof of concept.

The only thing I didn't really do is test extensively. Hopefully it works as well in practice as in the demo! I figure this repo's broken anyway with this news, so there's no risk in committing something untested!

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

No branches or pull requests

2 participants