[v4] Does Tailwind's built-in purge affect source files or just build output? #17570
Closed
alex-x-x-x-x
started this conversation in
General
Replies: 1 comment 4 replies
-
I wouldn't call it purging. That was old phrasing used during Tailwind v2. In this older version, a predefined list of classes where built up in dev. This list would then get trimmed down to only used classes, hence the term "purging". While from v2 JIT onwards, only the used set of classes are built at all. There is no purging in the v2 sense. Though to answer your question, Tailwind does not modify your source template files at all, during dev or build. It only reads your source template files for Tailwind string class names to build CSS rules from. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using TailwindCSS with React and Vite, and I know that unused utility classes are automatically removed during production builds. I'm curious how this purge (tree-shaking) process works with regard to version control.
Specifically:
Does Tailwind's purge process ever modify source files, or does it only affect the generated output (e.g.,
dist/
) when runningnpm run build
?In my setup,
dist/
is in.gitignore
, so I'm assuming purged CSS changes never show up in Git — is that correct?Just trying to better understand whether purge has any impact on tracked files, and if there are edge cases (like static site setups) where that might differ.
Appreciate any insights, thanks!
Beta Was this translation helpful? Give feedback.
All reactions