reagent

A minimalistic ClojureScript interface to React.js http://reagent-project.github.io/
2020-12-03T10:08:23.333Z

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

p-himik 2020-12-03T10:26:41.333100Z

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.

2020-12-03T10:54:07.334300Z

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

p-himik 2020-12-03T10:55:04.334500Z

You should be able to find it.

p-himik 2020-12-03T10:56:29.334700Z

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-himik 2020-12-03T10:56:49.334900Z

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

ferossgp 2020-12-03T12:08:00.335100Z

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

👍 1
p-himik 2020-12-03T12:10:50.335300Z

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