-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Ensure @import layer(…) source(…) work together
#15084
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
Conversation
If it was _just_ `@import "foo" layer(…)`, then the import handling converted the `@media layer(…)` to `@layer …` already. But if there are more properties than that's not the case
This seems like a bug in the at-import code then, no? Layer's are supposed to be extracted into this way and it should instead create: @layer (utilities) {
@media source(none) {
/* Contents of the imported file */
}
}https://developer.mozilla.org/en-US/docs/Web/CSS/@import#syntax |
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 PR only fixes
@import 'tailwindcss/utilities' source('./paths') layer(utilities);and not
@import 'tailwindcss/utilities' layer(utilities) source('./paths');I think 🙈 I think it's fine to require layer to be the first part as per the at-import spec though, but there is still a bug in the at-import resolver 😬
|
Ah you are right, I was thinking about that people might do this themselves or if we got this if other tools handled imports. But you are right let me fix it there instead! |
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 should be handled in the substituteAtImports step
|
Oh ignore my comment |
|
Current thinking is that we do not want to support this since it won't work with third-party CSS @import resolvers (e.g. if your project depends on postcss-import or uses any sass/scss pre-processors) This still works though, even when using a third-party import resolver: @import 'tailwindcss/utilities' layer(utilities) source('./paths'); |
This PR fixes an issue where the combining
source(…)andlayer(…)didn't work well together.and
Worked well individually, but together they did not:
This is because when we handled the
@import, if you see alayer(…), the import handling already converts it to:However, if you have multiple params, it would be converted to:
In this case, we never handled the
@media layer(…)case correctly and we have to make sure to convert it to an@layer utilities {…}ourselves.