DEV Community

Discussion on: How to Set Up SvelteKit with Tailwind CSS

Collapse
 
khromov profile image
Stanislav Khromov

Hello and thank you for writing this tutorial!

I've followed along with it but ran into an issue - the resulting bundle.css does not have prefixed classes. It seems like PostCSS does not prefix them, unlike if you use a normal <style> tag where Svelte will prefix the classes.

I've added the prefix: 'my-prefix' setting to tailwind.config.js. It does work, but you have to write out the prefixed version in your code, so flex becomes my-prefix-flex, and so on. This gets old fast. πŸ˜…

In an ideal world, I would write the normal Tailwind classes and the resulting bundle would be automatically prefixed.

PS.
I've also tried the postcss-prefixer package, but then Svelte didn't include any of my classes in the bundle.css output. Perhaps i misconfigured it...

Thank you so much again and hope that you or someone else has solved this issue or have some suggestions for how to proceed!

Collapse
 
swyx profile image
swyx

no idea about that, sorry. I don't use any prefixes. perhaps check one of the alternative methods listed at the bottom to see if works