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 rule with supports() and/or layer() parsed as Raw #259

Open
bartveneman opened this issue Jul 24, 2023 · 3 comments
Open

@import rule with supports() and/or layer() parsed as Raw #259

bartveneman opened this issue Jul 24, 2023 · 3 comments

Comments

@bartveneman
Copy link

CSSTree doesn't seem to Lex/parse layer() and supports() in @import rules.

Reproduction

Repro on StackBlitz

For each of these examples the node's prelude is type Raw:

@import "my.css" layer;
@import "my.css" layer(test);
@import "my.css" layer supports(display: grid);
@import "my.css" layer (min-width: 768px);
@import "my.css" layer(base) supports(accent-color: green) (min-width: 768px);

Validator results

I'm slightly confused because the validator does recognise even the last example with their correct token types. Link

CSSTree validator with match results for complex import rule

I'd be happy to contribute a fix for this, but I got stuck on trying to add new logic to import.js, so I might need a bit of guidance.

@bartveneman bartveneman changed the title @import rule with supports() and/or layer() tokenized as Raw @import rule with supports() and/or layer() parsed as Raw Jul 25, 2023
@bartveneman
Copy link
Author

It looks like @ngtr6788 already implemented a fork for this for Svelte over here: https://github.com/sveltejs/svelte/pull/9098/files#diff-ed2fad2b231aca18fc2b692be85898d0099355fc12ceca4bdd2990faf5159d94, although it doesn't seem merged yet.

@lahmatiy
Copy link
Member

This was implemented and will be available in next major version soon.

I'm slightly confused because the validator does recognise even the last example with their correct token types

The validator works on tokens, not AST.

@bartveneman
Copy link
Author

Thanks for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants