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

Just-In-Time on-demand '!important' modifier does not work with variants #4823

Closed
draganovik opened this issue Jun 28, 2021 · 2 comments · Fixed by #4854
Closed

Just-In-Time on-demand '!important' modifier does not work with variants #4823

draganovik opened this issue Jun 28, 2021 · 2 comments · Fixed by #4854

Comments

@draganovik
Copy link

What version of Tailwind CSS are you using?

v2.2.4

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

"vue": "^3.0.5", "vite": "^2.3.8"

What version of Node.js are you using?

v14.17.0

What browser are you using?

Microsoft Edge 91.0.864.59

What operating system are you using?

macOS 11.4

Reproduction repository

https://github.com/draganovik/tailwindcss-jit-variant-important-error

Describe your issue

I needed to override some plugin's custom inline CSS that gets injected in HTML element on click,
I tried a tailwind command:

h1 { @apply dark:!text-green-500; }

to override style in dark mode but it didn't work.
Then I manually set:

@media (prefers-color-scheme: dark) { h1 { @apply !text-green-500; } }

And it worked fine.
I don't know if [variant]:![tailwind-class] is supported but it feels like it should be.

adamwathan added a commit that referenced this issue Jul 1, 2021
@adamwathan
Copy link
Member

Hey, thanks for the reproduction! I can confirm that @apply !text-green-500 includes the !important in the output but @apply dark:!text-green-500 does not, so this is definitely a bug.

Started a PR with a failing test here:

#4854

Hopefully can look at this in the near future.

@RobinMalfait
Copy link
Member

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

This has been fixed and will be available in the next 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

Successfully merging a pull request may close this issue.

3 participants