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

[Bug]: Important modifier not working #4202

Closed
jaulz opened this issue Apr 28, 2021 · 4 comments · Fixed by #4260
Closed

[Bug]: Important modifier not working #4202

jaulz opened this issue Apr 28, 2021 · 4 comments · Fixed by #4260

Comments

@jaulz
Copy link

jaulz commented Apr 28, 2021

What version of Tailwind CSS are you using?

2.1.2

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

vue-tailwind 2.2.1, webpack 5.21.2

What version of Node.js are you using?

v15.11.0

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction repository

https://play.tailwindcss.com/qVS5lsqxMS

Describe your issue

The important modifier does not work as announced here:
https://tailwindcss.com/docs/just-in-time-mode

The attached reproduction link should have a blue background but it is still gray:
image

@bradlc
Copy link
Contributor

bradlc commented Apr 30, 2021

Have you enabled JIT mode as described in the documentation? JIT mode is not currently supported in Tailwind Play, and you are using jit: true there instead of mode: 'jit'.

If you have enabled JIT mode correctly and it's still not working please provide a repository which reproduces the issue, thanks!

@Zertz
Copy link

Zertz commented Apr 30, 2021

We're running into this with mode: "jit" and @tailwindcss/postcss7-compat:

Input:

.ui-state-active {
    @apply !bg-none !whitespace-normal;
}

Output:

.ui-state-active {
    white-space: normal;
    background-image: none;
}

However, if I inline !whitespace-normal, it works as expected:
image

@adamwathan
Copy link
Member

To make utilities important with @apply you need to add the !important keyword to the end of the list:

.ui-state-active {
    @apply bg-none whitespace-normal !important;
}

This is something we could probably improve now that there's a dedicated important modifier though.

@adamwathan
Copy link
Member

Added support for this, will be in v2.2 but can test now in canary:

npm install -D tailwindcss@canary

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.

4 participants