Clojurians
# css

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

stephenway 19:30:18

anyone know how to import styles from a css file in cljs? http://ai.github.io/postcss-way/?full#29

martinklepsch 20:20:09

@stephenway: do you have an existing set of css files that you’d like to import or are you just interested in replicating the same architecture?

stephenway 20:23:20

I have existing css files and I’d like to load them into each cljs component in the same manner as i’m using PostCSS like import styles from ‘./component.css’;

stephenway 20:25:07

but yea, referencing for sure

martinklepsch 20:28:28

when using plain JS are those files compiled to JS beforehand or does the import thing load and parse them at runtime?

stephenway 20:31:18

I’m not entirely sure how that works in React.

stephenway 20:34:42

this seems to explain it a bit more in depth https://github.com/gajus/react-css-modules

martinklepsch 20:37:02

It’s probably not going to be fun integrating that heavily webpack oriented workflow into a cljs app

stephenway 20:37:55

ok I was looking for a native way to do this in cljs without any external tooling

stephenway 20:38:04

if the files exist in the cljs project

martinklepsch 20:40:38

@stephenway: there’s no plug and play solution. I guess you could come up with something based on garden that reads css files and generates appropriate cljs namespaces

stephenway 20:41:18

ahh ok, I’ll check that out, thanks @martinklepsch

stephenway 21:43:50

@wildermuthn: Oh no, that looks promising!

wildermuthn 21:45:01

I’ve had a lot of success with it! Pretty interesting. I’d never heard of the cssom before.

stephenway 21:47:43

I’m already using postcss for parsing, maybe this would be good passover just into a clojure app?