-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add "prefix" and "important" options to config #183
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Wrapping a set of rules with this at-rule will make every single property in those classes !important. I don't intend to use this in core, but it's really useful for folks who want to use Tailwind on top of an existing base of CSS where the non-important versions of our utilities might not be enough to defeat the specificity of their existing styles. Using this at-rule, someone could import Tailwind into their codebase like this: ``` @Important { @tailwind utilities; } ``` ...and then all of their Tailwind utilities would be !important, making it easy to use them to override their existing CSS.
Doesn't apply to `.container` since it's an oddball non-utility.
reinink
approved these changes
Nov 11, 2017
Member
reinink
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bravo!
This was referenced Nov 13, 2017
Closed
DCzajkowski
pushed a commit
to DCzajkowski/tailwindcss
that referenced
this pull request
Jul 23, 2019
Fix postcss.config.js examples
thecrypticace
pushed a commit
that referenced
this pull request
Nov 21, 2025
Here is everything you need to know about this update. Please take a good look at what changed and the test results before merging this pull request. ### What changed? #### ✳️ @emnapi/runtime (1.6.0 → 1.7.1) · [Repo](https://github.com/toyobayashi/emnapi) <details> <summary>Release Notes</summary> <h4><a href="https://github.com/toyobayashi/emnapi/releases/tag/v1.7.1">1.7.1</a></h4> <blockquote><h2 dir="auto">What's Changed</h2> <ul dir="auto"> <li>move Node-API version detection by <a href="https://bounce.depfu.com/github.com/toyobayashi">@toyobayashi</a> in <a href="https://bounce.depfu.com/github.com/toyobayashi/emnapi/pull/182">#182</a> </li> <li>feat: support SharedArrayBuffer in napi_create_dataview by <a href="https://bounce.depfu.com/github.com/toyobayashi">@toyobayashi</a> in <a href="https://bounce.depfu.com/github.com/toyobayashi/emnapi/pull/183">#183</a> </li> </ul> <p dir="auto"><strong>Full Changelog</strong>: <a href="https://bounce.depfu.com/github.com/toyobayashi/emnapi/compare/v1.7.0...v1.7.1"><tt>v1.7.0...v1.7.1</tt></a></p></blockquote> <h4><a href="https://github.com/toyobayashi/emnapi/releases/tag/v1.7.0">1.7.0</a></h4> <blockquote><h2 dir="auto">What's Changed</h2> <ul dir="auto"> <li>feat: add napi_create_object_with_properties method by <a href="https://bounce.depfu.com/github.com/toyobayashi">@toyobayashi</a> in <a href="https://bounce.depfu.com/github.com/toyobayashi/emnapi/pull/181">#181</a> </li> </ul> <p dir="auto"><strong>Full Changelog</strong>: <a href="https://bounce.depfu.com/github.com/toyobayashi/emnapi/compare/v1.6.0...v1.7.0"><tt>v1.6.0...v1.7.0</tt></a></p></blockquote> <p><em>Does any of this look wrong? <a href="https://depfu.com/packages/npm/@emnapi%2Fruntime/feedback">Please let us know.</a></em></p> </details> <details> <summary>Commits</summary> <p><a href="https://github.com/toyobayashi/emnapi/compare/86d68f88ec3cc3949a555c93a633fa8997534413...f40577ad6013236e46bef57d829ece20773997bb">See the full diff on Github</a>. The new version differs by 6 commits:</p> <ul> <li><a href="https://github.com/toyobayashi/emnapi/commit/f40577ad6013236e46bef57d829ece20773997bb"><code>1.7.1</code></a></li> <li><a href="https://github.com/toyobayashi/emnapi/commit/c95f961fbcd33be46cdcc7ae77fb299c773a675a"><code>feat: support SharedArrayBuffer in napi_create_dataview (#183)</code></a></li> <li><a href="https://github.com/toyobayashi/emnapi/commit/92964e3738bd380c9c66bfc2cf8f332d108035f1"><code>move Node-API version detection (#182)</code></a></li> <li><a href="https://github.com/toyobayashi/emnapi/commit/11f4936f39121d0d79bc4901cf14dca02ef4abea"><code>1.7.0</code></a></li> <li><a href="https://github.com/toyobayashi/emnapi/commit/44bd3c798d97952d5dccc2fc9ab14494b9ef7964"><code>[Backport] feat: add napi_create_object_with_properties method (#181)</code></a></li> <li><a href="https://github.com/toyobayashi/emnapi/commit/62ab842b64f14da4a9838861758cbcb5c8465900"><code>ci: fix version retrieval</code></a></li> </ul> </details> ---  [Depfu](https://depfu.com) will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with `@depfu rebase`. <details><summary>All Depfu comment commands</summary> <blockquote><dl> <dt>@depfu rebase</dt><dd>Rebases against your default branch and redoes this update</dd> <dt>@depfu recreate</dt><dd>Recreates this PR, overwriting any edits that you've made to it</dd> <dt>@depfu merge</dt><dd>Merges this PR once your tests are passing and conflicts are resolved</dd> <dt>@depfu cancel merge</dt><dd>Cancels automatic merging of this PR</dd> <dt>@depfu close</dt><dd>Closes this PR and deletes the branch</dd> <dt>@depfu reopen</dt><dd>Restores the branch and reopens this PR (if it's closed)</dd> <dt>@depfu pause</dt><dd>Ignores all future updates for this dependency and closes this PR</dd> <dt>@depfu pause [minor|major]</dt><dd>Ignores all future minor/major updates for this dependency and closes this PR</dd> <dt>@depfu resume</dt><dd>Future versions of this dependency will create PRs again (leaves this PR as is)</dd> </dl></blockquote> </details> Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
thecrypticace
pushed a commit
that referenced
this pull request
Nov 21, 2025
Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request. ### What changed? #### ✳️ emnapi (1.6.0 → 1.7.1) · [Repo](https://github.com/toyobayashi/emnapi) <details> <summary>Release Notes</summary> <h4><a href="https://github.com/toyobayashi/emnapi/releases/tag/v1.7.1">1.7.1</a></h4> <blockquote><h2 dir="auto">What's Changed</h2> <ul dir="auto"> <li>move Node-API version detection by <a href="https://bounce.depfu.com/github.com/toyobayashi">@toyobayashi</a> in <a href="https://bounce.depfu.com/github.com/toyobayashi/emnapi/pull/182">#182</a> </li> <li>feat: support SharedArrayBuffer in napi_create_dataview by <a href="https://bounce.depfu.com/github.com/toyobayashi">@toyobayashi</a> in <a href="https://bounce.depfu.com/github.com/toyobayashi/emnapi/pull/183">#183</a> </li> </ul> <p dir="auto"><strong>Full Changelog</strong>: <a href="https://bounce.depfu.com/github.com/toyobayashi/emnapi/compare/v1.7.0...v1.7.1"><tt>v1.7.0...v1.7.1</tt></a></p></blockquote> <h4><a href="https://github.com/toyobayashi/emnapi/releases/tag/v1.7.0">1.7.0</a></h4> <blockquote><h2 dir="auto">What's Changed</h2> <ul dir="auto"> <li>feat: add napi_create_object_with_properties method by <a href="https://bounce.depfu.com/github.com/toyobayashi">@toyobayashi</a> in <a href="https://bounce.depfu.com/github.com/toyobayashi/emnapi/pull/181">#181</a> </li> </ul> <p dir="auto"><strong>Full Changelog</strong>: <a href="https://bounce.depfu.com/github.com/toyobayashi/emnapi/compare/v1.6.0...v1.7.0"><tt>v1.6.0...v1.7.0</tt></a></p></blockquote> <p><em>Does any of this look wrong? <a href="https://depfu.com/packages/npm/emnapi/feedback">Please let us know.</a></em></p> </details> <details> <summary>Commits</summary> <p><a href="https://github.com/toyobayashi/emnapi/compare/86d68f88ec3cc3949a555c93a633fa8997534413...f40577ad6013236e46bef57d829ece20773997bb">See the full diff on Github</a>. The new version differs by 6 commits:</p> <ul> <li><a href="https://github.com/toyobayashi/emnapi/commit/f40577ad6013236e46bef57d829ece20773997bb"><code>1.7.1</code></a></li> <li><a href="https://github.com/toyobayashi/emnapi/commit/c95f961fbcd33be46cdcc7ae77fb299c773a675a"><code>feat: support SharedArrayBuffer in napi_create_dataview (#183)</code></a></li> <li><a href="https://github.com/toyobayashi/emnapi/commit/92964e3738bd380c9c66bfc2cf8f332d108035f1"><code>move Node-API version detection (#182)</code></a></li> <li><a href="https://github.com/toyobayashi/emnapi/commit/11f4936f39121d0d79bc4901cf14dca02ef4abea"><code>1.7.0</code></a></li> <li><a href="https://github.com/toyobayashi/emnapi/commit/44bd3c798d97952d5dccc2fc9ab14494b9ef7964"><code>[Backport] feat: add napi_create_object_with_properties method (#181)</code></a></li> <li><a href="https://github.com/toyobayashi/emnapi/commit/62ab842b64f14da4a9838861758cbcb5c8465900"><code>ci: fix version retrieval</code></a></li> </ul> </details> ---  [Depfu](https://depfu.com) will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with `@depfu rebase`. <details><summary>All Depfu comment commands</summary> <blockquote><dl> <dt>@depfu rebase</dt><dd>Rebases against your default branch and redoes this update</dd> <dt>@depfu recreate</dt><dd>Recreates this PR, overwriting any edits that you've made to it</dd> <dt>@depfu merge</dt><dd>Merges this PR once your tests are passing and conflicts are resolved</dd> <dt>@depfu cancel merge</dt><dd>Cancels automatic merging of this PR</dd> <dt>@depfu close</dt><dd>Closes this PR and deletes the branch</dd> <dt>@depfu reopen</dt><dd>Restores the branch and reopens this PR (if it's closed)</dd> <dt>@depfu pause</dt><dd>Ignores all future updates for this dependency and closes this PR</dd> <dt>@depfu pause [minor|major]</dt><dd>Ignores all future minor/major updates for this dependency and closes this PR</dd> <dt>@depfu resume</dt><dd>Future versions of this dependency will create PRs again (leaves this PR as is)</dd> </dl></blockquote> </details> Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This could've been two separate PRs but it's really just the consolidation of #99 and #100 but moved into the config file instead of being made available as at-rules.
This PR adds support for a new
optionskey in the config file, with two options so far:Prefix
The prefix option causes all of Tailwind's utilities to be generated with the given prefix.
This is (shockingly) more complex than it sounds, so there's a few rules worth understanding.
The prefix is added to the beginning of the utility name, not the full class name.
This means that if you set a prefix of
tw-, you'll get utilities that look like this:...not like this:
This may seem counter-intuitive at first, keep reading.
Your own classes that Tailwind touches with features like
@responsivedo not adopt this prefix.For example, this custom class wrapped in
@responsive:...will generate this code:
...not this code:
This is the reason for putting the prefix at the beginning of the utility name, not the class name.
If we put the prefix at the beginning of the full class, your own custom utilities would have no prefix, and the responsive prefixes would look different:
This inconsistency was ugly enough that it felt like putting the prefix before just the utility portion was the right move, because the only other option was prefixing your own custom utilities too, and that didn't feel right either.
Important
Important is simpler; it just makes all of Tailwind's utilities
!important.It doesn't make any of your own custom utilities that use Tailwind features important though; if you want that behavior, simply mark them as
!importantyourself:One important special case here is the
.containerclass. Using theimportantoption does not make the.containerclass important.This is because that class isn't really a utility; it's more of a component. It already gets special treatment in the codebase in that it doesn't get responsive variations generated (
.md:container,.lg:container, etc.).Since it's more of a component, it makes sense that it's styles should be overridable if needed, even though I don't know why you'd ever do that.
The End.
If you have opinions about all the prefix positioning crap I am open to hearing them, we argued about it for a while and this seemed like the best solution.