Tailwind v4.1 – How to prevent purge of dynamic classes like from-${type}
/ to-${type}
?
#17999
-
Tailwind v4.1 – How to prevent purge of dynamic classes like Hi Tailwind team 👋 I'm using Tailwind CSS v4.1 in a Vite project, with the new With the new version there is no In my Vue 3 app, I dynamically generate class names for gradients based on Pokemon types, like this: const bgClass = `bg-gradient-to-br from-${color1} to-${color2}` |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey! There is no such thing as a purge step. Tailwind works by generating classes it can see. You can read more about this here: https://tailwindcss.com/docs/detecting-classes-in-source-files#dynamic-class-names One thing you can do is use CSS variables and use those in the |
Beta Was this translation helpful? Give feedback.
-
The question, however, remains. How can we disable this step and generate all classes in Tailwind? For example I am now using a component library linked in my Angular project and Tailwind cannot see the classes in my linked library. How can we include the entire Tailwind library? |
Beta Was this translation helpful? Give feedback.
Hey!
There is no such thing as a purge step. Tailwind works by generating classes it can see.
You can read more about this here: https://tailwindcss.com/docs/detecting-classes-in-source-files#dynamic-class-names
One thing you can do is use CSS variables and use those in the
from-(--my-from-value)
andto-(--my-to-value)