'Compile tailwindcss + typescript

I have a very simple app with some html, css, and ts files. I use swc to compile the typescript and copy over the html/css/assets. Now, I'm looking to add tailwind to my project, but I'm not sure how it will fit in to the build process.

Currently, my build is very simple, I just run swc src -Dw --out-dir=built. However, I'm not sure of the interplay between swc and tailwind. Should I run tailwind first on my src directory, build into some intermediary directory, and then run swc in that directory? Can tailwind even process ts files?

All resources online seem to be tailored for people using react/nextjs with a complicated build system I don't understand.



Solution 1:[1]

TailwindCSS is independent of SWC. So you can run them both separately in either order. And you can run them both on the source files, not the compiled JavaScript.

I'd look into using the TailwindCSS CLI. The docs page for it outlines exactly how to import the resulting css into your simple app. https://tailwindcss.com/docs/installation

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nick