Replies: 2 comments 1 reply
-
|
Not a solution, but wanted to clarify that Tailwind doesn't purge unused CSS classes per se. Rather, it never generates them in the first place. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah. Tailwind CSS only includes the class names it can detect in the source code in the generated CSS; anything it cannot detect is not included. This is how it ensures that the compiled CSS stays small. If user-generated content introduces some form of dynamism, for example
Since your exact use case and reproduction steps are not known, the above is simply me thinking out loud. From the purging behavior, I assume that you checked DevTools and cannot find the custom classes you declared:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on a project that renders user generated content. I am using v4 and there seem to be no way to keep the engine away from purging my css classes. I don't really want to go and make a safe-list and maintain it and nothing else seems to work for the v4, from global scoping to forced imports via side-effects in the main entry files.
Any suggestions?
Beta Was this translation helpful? Give feedback.
All reactions