Skip to content
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

Variants are emitted regardless of layer configuration #6737

Closed
ishitatsuyuki opened this issue Dec 26, 2021 · 1 comment
Closed

Variants are emitted regardless of layer configuration #6737

ishitatsuyuki opened this issue Dec 26, 2021 · 1 comment

Comments

@ishitatsuyuki
Copy link

ishitatsuyuki commented Dec 26, 2021

What version of Tailwind CSS are you using?
v3.0.7

What build tool (or framework if it abstracts the build tool) are you using?
Tailwind CLI

What version of Node.js are you using?
v17.3.0

What browser are you using?
N/A

What operating system are you using?
Linux

Reproduction URL
https://play.tailwindcss.com/dIFXv0zZfF

Describe your issue

We are gradually migrating from another CSS reset to Tailwind's reset. To achieve this, we separate the stylesheet into two, so for old pages we can use Tailwind rules with the legacy CSS reset, while for new pages we adopt Tailwind's base/reset:

/* tailwind-base.css */
@tailwind base;
/* tailwind.css */
@tailwind components;
@tailwind utilities;

It works pretty nice, except that utility variants also ends up getting included in tailwind-base.css. This is what the playground link reproduces.

The reason this happens seems to be that all variant declaration seems to get thrown into the a "variant" category, regardless if the layer is actually enabled:

if (sort >= context.minimumScreen) {

The fix can be done by putting a check before we insert the rule into the set. And I figured this out just as I complete writing the issue ;)

@RobinMalfait
Copy link
Contributor

Hey! Thank you for your bug report!
Much appreciated! 🙏

This is fixed by #7066 and is available in the latest release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants