Adding a custom prefix for tailwind 4.0 #16046
Replies: 8 comments 9 replies
-
|
@DennisVulders how do you set the prefix? |
Beta Was this translation helpful? Give feedback.
-
|
@DennisVulders Just tested your theory and this is working for me.
|
Beta Was this translation helpful? Give feedback.
-
|
The prefix became a variant starting from v4, so Tailwind can now apply it at the very beginning of every class name. For example, in v3: From a readability standpoint, it's debatable which approach is better, but in terms of functionality, handling it as a variant fits much more naturally into the TailwindCSS syntax than the v3-style prefix. I believe this won't change from v4 onward, and it won't be possible to revert to using the old prefixes. |
Beta Was this translation helpful? Give feedback.
-
|
We use Tailwind at GitLab and this is a bummer for us as we use the Would you consider making this configurable? I would be happy to take a stab at opening a PR 🙂 |
Beta Was this translation helpful? Give feedback.
-
|
Similar to the above. At @bitwarden, I am considering keeping the company on Tailwind 3 due to the difficulty/size of the migration. Perhaps having a config option would allow us to tackle the migration incrementally? |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
-
|
I'm in the exact same boat. We currently manage multiple repositories that all rely on a single, shared Tailwind configuration using the Upgrading to v4 is currently a blocker for us because migrating away from this prefix isn't a simple find-and-replace task. Dealing with nested modifiers and variants across thousands of files in different active codebases would be extremely error-prone and would trigger endless merge conflicts for our teams. Are there any updates on whether customizable prefix separators (or specifically supporting Thanks to the team for all the incredible work on v4 otherwise! |
Beta Was this translation helpful? Give feedback.
-
|
For large-scale applications, maintaining the kebab-case prefix (tw-) is crucial for both readability and keeping a smooth migration path from v3. The jump to the variant colon separator (tw:) introduces unnecessary friction for existing codebases. Having this be configurable would drastically increase v4 adoption rates for enterprise projects. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey All,
We are currently upgrading our code from tailwind 3 to tailwind 4 and we (like many others) use the "tw-" prefix. While after searching for a while i did find out that prefixes can be added but it would then be used as tw:width-full for example. To make tailwind 4 more backwards compatible and in my personal opinion i think the readability of the "tw:" is worse than the "tw-" prefix, since the classes themselves are also kebab-case.
I know that we can still use the old config to do this, but it would be ideal if it is possible to use:
@import "tailwindcss" prefix(tw-);So that we can all use tw-w-full etc.Hopefully this can be a feature in a future release of tailwind 4.x 🙂
Beta Was this translation helpful? Give feedback.
All reactions