-
Notifications
You must be signed in to change notification settings - Fork 4.5k
@apply behaviour for not-imported "tailwindcss/utilities" changed in 2.0 #3024
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
Comments
This is an undocumented breaking change I guess — Tailwind internally looks for references to We can probably make this still work, and @RobinMalfait is actually working on an unrelated thing that would force us to tackle this too. Out of curiousity, why are you running PostCSS against index.css, and separately against the files it imports? Why isn't just running it against index.css enough? |
@adamwathan Thanks for the reply. I understand the reasoning behind this, but how could
I'm using Tailwind in an internal CSS foundation module, which apps depend on (as npm module). In order for the cascade to work (utilities override, etc), I need to provide two exported CSS files:
They are used like this in @import "css-foundation/base";
/* all the app specific code here in the middle */
@import "css-foundation/utils"; On top of that, I build a big Hope that makes sense. |
Hey, this behaviour is currently broken because of: @import 'tailwindcss/base';
body {
@apply antialiased;
} We made the assumption that if we see In v1 we just generated all the utilities, but this means that we do all the work twice, therefore we had this shortcut. I have an open PR (#3032) where we check for |
Hey! This is fixed and will be tagged in the next release! |
Amazing! Thanks. Will try it out! |
Hi all!
Summary
In 2.0, Tailwind won't build a file which uses a utility class with
@apply
, and wheretailwindcss/utilities
isn't imported anywhere in the same CSS tree. This worked in 1.x.I've just embarked on upgrading our Tailwind powered CSS module to Tailwind 2.0.1. The upgrade guide is great, but I ran into an issue with
@apply
.The setup is this:
index.css
,base.css
, andutils.css
.index.css
file importsbase.css
andutils.css
.index.css
base.css
utils.css
The problem
When I run PostCSS on
index.css
, everything is fine. But when I run it onbase.css
, PostCSS fails.This error makes sense, since
base.css
doesn't import the "utilities" Tailwind module.BUT, this works fine with
tailwindcss@1.6.2
, and fails intailwindcss@2.0.1
😭Was this unintended (unsupported/accidental) behaviour in
1.x
, or is it an undocumented breaking change in2.x
?Link to a minimal reproduction
See: https://github.com/brookback/tailwind-repro.
The repo includes two directories, with the exact same CSS source, but with different versions of Tailwind and PostCSS.
npm run build
in1.x
directory to see behaviour for Tailwind 1.x (1.6.2).npm run build
in2.x
directory to see behaviour for Tailwind 2.x (2.0.1).The former will succeed, but the latter will not.
Thanks!
The text was updated successfully, but these errors were encountered: