How to load css files in ClojureScript project with shadow-cljs
Asked Answered
C

1

7

I have a styles.css file and I need to load it from a cljs to pass it as a props to a react lib.

The import in node is:

import styles from './styles.css'

Is it possible to do this in ClojureScript with shadow-cljs?

Celin answered 22/3, 2019 at 22:11 Comment(0)
L
7

Importing styles.css in webpack is handled by the style-loader which you can sort of hook up by following the webpack guide and exporting things to global objects.

ClojureScript itself (or shadow-cljs) does not support anything in that regard but you could possibly create something similar using macros.

Labarum answered 24/3, 2019 at 10:20 Comment(1)
No, not currently. I wrote an alternative in shadow.markup which functions similarly to the styled-components library but it isn't documented very well. There are other alternatives using the garden clojure lib.Labarum

© 2022 - 2024 — McMap. All rights reserved.