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
Error on embedded imports in data urls #543
Error on embedded imports in data urls #543
Conversation
If such imports are completely useless, why do we output useless imports vs. erroring? |
A warning would help users to write more effective CSS. But a hard error might be too much as this is perfectly valid CSS, it's just CSS that isn't applied. This is similar to the warning for empty files. |
I've added a suggestion for a warning, please let me know if this is clear.
Update : I found that setting |
@@ -1,6 +1,28 @@ | |||
@import url(foo.css);p { color: green; }p { color: blue; }@media (min-width: 320px){@layer foo{ | |||
p { color: green; } } }@media (min-width: 320px){@layer foo{ | |||
p { color: green; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change affects the output format because the first node is removed.
Needs rebase.
In other words, you're saying browsers ignore imports like these? I'm not sure if that's a valid premise to build on, because browsers will continue to parse the CSS they can, even if an import results in a 404; however, as a build tool, we'd be remiss not to error out if we can't resolve an import. |
89500c1
to
17a32a6
Compare
Makes sense! Thank you for reviewing these 🙇 |
The current code prevents further inlining of embedded imports but it doesn't stop a browser from possible loading and applying it.
Addingnot all
has the intended effect.Setting
stmt.children = []
prevents inlining and removes the@import
statement.