8000 Support `@import` rule from CSS Cascade 4 and `src()` function from CSS Values 4 · Issue #3965 · sass/sass · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support @import rule from CSS Cascade 4 and src() function from CSS Values 4 #3965

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

Open
ntkme opened this issue Oct 18, 2024 · 4 comments
Open
Labels
awaiting browser support Blocked on at least one browser implementing something CSS compatibility Support the CSS spec

Comments

@ntkme
Copy link
Contributor
ntkme commented Oct 18, 2024

https://www.w3.org/TR/css-cascade-4/#at-import

@import [ <url> | <string> ]
        [ supports( [ <supports-condition> | <declaration> ] ) ]?
        <media-query-list>? ;

https://www.w3.org/TR/css-values-4/#urls

<url> = <url()> | <src()>

<url()> = url( <string> <url-modifier>* ) | <url-token>
<src()> = src( <string> <url-modifier>* )
  • url() can take quoted or unquoted URL string.
  • src() can take quoted URL string or var(--css-variable).

More details are in the linked w3 specifications.

@nex3
Copy link
Contributor
nex3 commented Oct 18, 2024

Do any browsers support @import src() currently?

@nex3 nex3 added the needs info Blocked on user response label Oct 18, 2024
@ntkme
Copy link
Contributor Author
ntkme commented Oct 18, 2024

Looks like no one really support @import src() at this moment.

Firefox has a tracking issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1707923
Other browsers do not even have a tracking issue.

@nex3 nex3 added awaiting browser support Blocked on at least one browser implementing something and removed needs info Blocked on user response labels Oct 18, 2024
@idlist
Copy link
idlist commented Nov 10, 2024

Didn't really dig into the things, but how's this different from the current intent of deprecating @import, and then maybe fully hand over @imports to CSS? Since @import <string> | <url> and url() has been a thing for quite a long time (though having some different semantics), and only src() don't.

@ntkme
Copy link
Contributor Author
ntkme commented Nov 10, 2024

The new src() syntax will likely get parsed only as a pure css @import statement rather than a sass @import statement. Therefore, the deprecation of sass’ @import statement is not relevant to the new syntax.

The only thing relevant to the deprecation is that currently the pure css parser parses the pure css @import url() as InterpolatedFunctionExpression and throws if interpolation is found with in the argument. It was designed to give users a hint that their @import statement is being parsed as pure css @import, which behaves differently than sass @import. However, it also introduced an unexpected error when a stylesheet has an intentional pure css @import url("path#{hash}") that is supposed to have a url hash which syntax wise looks the same as sass interpolation. This unexpected error will not get immediately changed, but should get fixed when sass @import statement is completely dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting browser support Blocked on at least one browser implementing something CSS compatibility Support the CSS spec
Projects
None yet
Development

No branches or pull requests

3 participants
0