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: 1 comment 1 reply
-
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.
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)