Replies: 11 comments 17 replies
-
Not solved yet but something we're going to look into soon. I secretly wish no one used this feature though 😄 |
Beta Was this translation helpful? Give feedback.
-
Hi, just wondering if there is an update on this. I am using a variable name in my class name (something like |
Beta Was this translation helpful? Give feedback.
-
Is there any news on how safelist will work in v4? (not using tailwind.config.js) |
Beta Was this translation helpful? Give feedback.
-
I guess it's always possible to include all supported classes somewhere, be it a component's allowed props or maybe even a text file you import somewhere, right? |
Beta Was this translation helpful? Give feedback.
-
I faced one use case for cms html content that uses Tailwind for styling. I think Tailwind v4 should natively support a safelist again. |
Beta Was this translation helpful? Give feedback.
-
As long as it's the only thing that prevent me from going to v4 I created an issue to know the development point of it. |
Beta Was this translation helpful? Give feedback.
-
here a good answere made and explain the global issue with safelist and how to implement similar things if anyone wondering #16592 (comment) |
Beta Was this translation helpful? Give feedback.
-
When migrating the project to Next.js v15 and Tailwind v4, I encountered an issue where I could no longer use Why i used
|
Beta Was this translation helpful? Give feedback.
-
Another good solution for cases where the "color" (hex, OKLCH, rgba or whatever) comes from a CMS is to use <div style="--foo-bg: ${COLOR_FROM_CMS};" class="bg-(--foo-bg)">...</div> This way, you end up with a single selector in the compiled Tailwind CSS, but it still covers any color coming from the CMS. |
Beta Was this translation helpful? Give feedback.
-
I read up on why you guys removed safelisting and your reasoning makes sense. That being said, it's still pretty important in our production React application where we do this:
Those We prefer doing it this way as it's more "React-y" and it standardizes how we use some of the more commonly used Tailwind utility classes. The Tailwind docs state that it's best to avoid dynamic classes, but IMO that goes against modern frameworks such as React. It'd be great if we could somehow register used classes at run-time (locally), IE save them to some file in the project that Tailwind reads when it detects a new class. This would remove the need for a safelist entirely for us. I could use that register function in my It could look something like: Storing all these classes in a |
Beta Was this translation helpful? Give feedback.
-
Hey everyone! A new safelist option is coming. Instead of regex patterns you will be able to use bash brace expansion syntax. More info in the PR: #17147 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
With no tailwind.config.js in v4 anymore - how can we implement the
safelist: []
option in v4? Is there a @safelist directive?Beta Was this translation helpful? Give feedback.
All reactions