Replies: 5 comments 4 replies
-
A workaround could be to list all classes in a unused file and source it like so: @source "./safelist.css"; |
Beta Was this translation helpful? Give feedback.
-
@ic-768 Our solve for this was to create a JS file that creates all the safelist classes and outputs them into a txt file that is in our theme code that tailwind watches during our build process. Not ideal but it works better then typing out all the permutations. Used an array to mimic the pattern style. |
Beta Was this translation helpful? Give feedback.
-
Not sure if this fits your needs, but we’ve created a Rust script that, in development mode, opens a WebSocket and receives dynamically generated class names, which it writes into a Workflow
This allows us to completely remove the need for Tailwind's Known Issues / Odd Behaviors
Pros of This Approach
|
Beta Was this translation helpful? Give feedback.
-
A solution I had used in a similar situation to yours (a component library where classes can be typed and displayed live) was actually to use the Tailwind CDN. This seemed like one of those times it was good use case for the CDN, if viable for your app. I originally used your method of having a text file with as many classes as possible, but this was very tough to maintain for obvious reasons and missed many variations. What I did was dynamically load the CDN script only on the pages that needed them. This worked really well for me and also avoided a lot of the headache. |
Beta Was this translation helpful? Give feedback.
-
There's now |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
My company's app has an integrated component library, that creates classes programmatically, like so:
We used to be able to safelist all of these, by providing a regex pattern to safelist, e.g.:
Now with the safelist not supported in v4, the only solution I can find for cases like these is manually inputting all the classes in a text file so that they can be parsed. Needless to say, I'd rather not do that.
Is there any other solutions for cases like this?
Beta Was this translation helpful? Give feedback.
All reactions