Clojurians
#css
<
2015-11-13
>

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

stephenway17:11:18

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

martinklepsch18:11: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?

stephenway18:11: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’;

stephenway18:11:07

but yea, referencing for sure

martinklepsch18:11:28

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

stephenway18:11:18

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

stephenway18:11:42

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

martinklepsch18:11:02

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

stephenway18:11:55

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

stephenway18:11:04

if the files exist in the cljs project

martinklepsch18:11: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

stephenway18:11:18

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

stephenway19:11:50

@wildermuthn: Oh no, that looks promising!

wildermuthn19:11:01

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

stephenway19:11:43

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