Fork me on GitHub
#reagent
<
2020-12-03
>
kimim10:12:23

hello, how to load react component css in cljs? Thanks.

p-himik10:12:41

Just as you would load any external CSS file. There's nothing built in to make this automatic. If you want to make the CSS data available to your CLJS, you can load it via a macro during the compilation time.

kimim10:12:07

But I don’t know the location the css is located from an NPM lib.

p-himik10:12:04

You should be able to find it.

p-himik10:12:29

When you see something like require('main.css') in JS, it's no longer "vanilla JS" - it's JS that's supposed to be compiled with webpack. None of the CLJS build tools that I'm familiar with use webpack.

p-himik10:12:49

You can try using webpack with one of the CLJS build tools, but I would recommend against it.

ferossgp12:12:00

I use postcss-cli with postcss-import plugin to compile css, and then just require the output css in the html

👍 3
p-himik12:12:50

Yeah, that's what I do as well, only I've embedded SASS compiler into my main CLJS compilation process.