svelte icon indicating copy to clipboard operation
svelte copied to clipboard

Missing support for @import urls with layer() functions.

Open kwangure opened this issue 1 year ago • 2 comments

Describe the bug

CSS now has pretty wide support for @layer/layer(). However Svelte chokes on @import statements assigned to a particular layer.

@import url("bootstrap.css") layer(framework);

You can work around by putting the styles in a CSS file then import that file instead, but this only works if you do not preprocess your code to inline CSS brought in via @import or by using JS imports.

Reproduction

https://svelte.dev/repl/0bf3cf34781c4dfa8968cdba3fc1644d?version=3.59.1

Logs

No response

System Info

N/A

Severity

annoyance

kwangure avatar May 31 '23 05:05 kwangure

When I checked csstree it seemed to already be supported. I think Svelte just needs to updated now.

kwangure avatar May 31 '23 16:05 kwangure

It looks like @layer was added to Svelte in a one-line change here: https://github.com/sveltejs/svelte/pull/7514

Hopefully @import layer() wouldn't be much harder though I confess ignorance to this section of the code

benmccann avatar May 31 '23 16:05 benmccann

I noticed that css-tree itself doesn't quite lex/parse the @import rule properly yet, as per this issue: https://github.com/csstree/csstree/issues/259

ngtr6788 avatar Aug 08 '23 02:08 ngtr6788