Possible bug with layers and JIT compiler #5506
-
Hi folks, I'm doing the following:
I can only prevent those classes from getting jitted/purged when I add them to my safelist. Or when I actually use them of course. I'm under the impression that any layer not included in step 2 should always make it to the final CSS. Here's a tailwind.zip to demo this. Steps to reproduce:
I've got a feeling this is either a bug since according to the docs this is what the Thanks and kind regards, Rob |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey Rob! Right now the JIT engine doesn't pay any attention to the One workaround is to just put the CSS in your CSS file in the right spot but outside of a layer: @tailwind base;
.some-base-thing {
/* ... */
}
@tailwind components;
@tailwind utilities; We should make sure we throw a warning for using the I'm going to think on a better solution going forward, especially since CSS has added a real @tailwind base;
@tailwind components;
@tailwind utilities;
/* This would be generated on-demand */
@tailwind base {
.some-base-thing {
/* ... */
}
}
/* This would be included no matter what but relocated to the base layer */
@tailwind base static {
.some-other-base-thing {
/* ... */
}
} What do you think about something like that? 🤔 |
Beta Was this translation helpful? Give feedback.
Hey Rob! Right now the JIT engine doesn't pay any attention to the
layers
option — anything in a reserved@layer
(base, components, or utilities) is automatically turned into "on demand" styles so it's not inserted unless it's used.One workaround is to just put the CSS in your CSS file in the right spot but outside of a layer:
We should make sure we throw a warning for using the
layers
option or something though. It's not quite as simple as just making it work unfortunately, because anything in a layer also automatically gets all variants enabled, so in the example above if you putsome-base-thing