Tailwind Not applying?

hello, I am creating a set of fake "note cards" to display with different colors. When I created one card with one color, it worked, but now I'm using onMount to create many notecards in a loop and the tailwind color style is not applying. The font color is though, so I am inclined to believe it has to do with the order of rendering and applying styles. Any tips?
2 Replies
REEEEE
REEEEE2y ago
I'm pretty sure this is a tailwind issue I use unocss, and to solve this type of issue I use the safelist property in the config Looks like tailwind has it too, but it seems to not be recommended? https://tailwindcss.com/docs/content-configuration#safelisting-classes
high1
high12y ago
It's not an issue - it's the way tailwind and unocss work - parse the code, and keep only class strings found inside it. When a string is dynamically created, there's no way for parser to know that it should include it in the emitted css - this is what safelist is for.
Want results from more Discord servers?
Add your server