HI! Today I was trying to use TailwindCSS in my Ko...
# javascript
o
HI! Today I was trying to use TailwindCSS in my KotlinJS project and I can't find a way to do it. Can anyone help please? I didn't find anything in the documentation on how to link external CSS/PostCSS to my project. One thing I tried is posted on StackOverflow https://stackoverflow.com/questions/64029151/how-to-add-tailwindcss-to-kotlinjs. I will update the question if someone helps.. Thanks!
b
Either:
Copy code
@JsModule("css/main.css")
@JsName("default")
external val useless:dynamic
Or use require from kotlin-externals (you can define it yourself as well if you want)
t
have responded with a gradle integration that runs the Tailwind CLI. If not clear / not quite what you were asking ping me and we can refine the answer
o
@Tristan Blakers This is awesome, I could even modify this to run
postcss-cli
rather than Tailwind CLI. Would it be possible to link PostCSS to webpack directly, as I was trying in the post?
t
IMO you're better off letting Tailwind call postcss rather than doing it directly, but it should be easy to go direct
do you have a working webpack config that integrates postcss? If so, should just be a matter of calling webpack from gradle?
given you're probably using npm anyway, my suggestion would be to get a working skeleton package.json that calls webpack, and make sure you can call it from the regular CLI. once that's working, you can call the necessary npm task from gradle
o
Ok, thanks a lot