DEV Community

Discussion on: [Update] Using Svelte with Tailwindcss - A better approach

Collapse
 
filip_uzunovic profile image
Case09 • Edited

Great solution! One thing that i'm still struggling with, i can't seem to use regular classes in my svelte files like <div class="bg-red-200">...</div>. It works if i rerun sapper dev. If i use @apply inside tag it works fine. Btw i added inside _layout.svelte. Any idea how to get this working without having to rerun npm run dev every time?

Collapse
 
sarioglu profile image
sarioglu

I'm not sure why it is happening. I will check this issue when I create the sapper template.

Collapse
 
srinivasarajui profile image
Srini Raju • Edited

I faced the same problem but fixed it with the following change.

Change line12 in postcss.config.js
from : const production = !process.env.ROLLUP_WATCH
to : const production = process.env.NODE_ENV !=='development'

Thread Thread
 
sarioglu profile image
sarioglu

Thanks for the information! In fact, using process.env.NODE_ENV in both setups would be better. However since process.env.ROLLUP_WATCH is used to determine mode in rollup.config.js, I wanted to be consistent with it. I've changed it to process.env.NODE_ENV in Sapper template.