Discussion on: A simpler way to add TailwindCSS to your Svelte project

o_a_e profile image
Johannes Zillmann

Thanks for that post!
2 questions:

  • (1) Why do you (and seemingly everybody else) put tailwind.css into the public folder ? It seems to me that only the generated index.css needs to be there and it makes more sense to put tailwind.css under src/ !?
  • (2) With this setup my @apply rules in the style section seem to get lost or not effective (Before i had it working with the setup of dev.to/sarioglu/using-svelte-with-...). Any way to make this work as well ?
linuxhurtme profile image
Today's dumb idea

2) This tutorial seems to follow a minimalist mindset and only compiles postcss files, not svelte files. If you want to process postcss in svelte files, follow the other tutorial for everything but purgecss. Everything else that differs is because he is calling postcss directly instead of using svelte-preprocessor which you need for running postcss in svelte files.

1) Source file doesn't have to be there, may need to be moved depending on your tooling. If you follow the other tutorial, both files and the generating npm commands should be deleted and contents put in the <style global> instead.