This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-29
Channels
- # architecture (14)
- # beginners (184)
- # boot (25)
- # cider (23)
- # clara (9)
- # cljsjs (13)
- # cljsrn (5)
- # clojure (140)
- # clojure-austria (1)
- # clojure-dev (24)
- # clojure-greece (15)
- # clojure-italy (7)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-sanfrancisco (10)
- # clojure-spec (39)
- # clojure-uk (28)
- # clojured (1)
- # clojurescript (26)
- # core-async (3)
- # cursive (13)
- # datomic (44)
- # docs (3)
- # emacs (31)
- # events (2)
- # figwheel (4)
- # fulcro (6)
- # graphql (2)
- # hoplon (5)
- # jobs (11)
- # juxt (4)
- # keechma (19)
- # leiningen (1)
- # off-topic (8)
- # om (8)
- # onyx (18)
- # parinfer (2)
- # re-frame (18)
- # reagent (24)
- # ring (4)
- # rum (2)
- # shadow-cljs (26)
- # sql (15)
- # timbre (6)
- # vim (2)
Hey all, this is probably a very noob question, but I'm wondering the best way to add a css class to a div in reagent.
I just created a project with "lein new re-frame my-project", and now I want to style my div. I don't yet have any css files in my project, but I'm thinking I could just add the css file and then change this part where the div is being rendered
[:div "Hello from " @name "]
Would be nice if I could do something like this:
[:div :class="cool-style" "Hello from " @name "]
[:div.cool-style "Hello from " @name]
[:div.cool-style1.cool-style2 {:style {:color "red"}} "really cool styles that are now red"]
thanks!
is {:style {:color "red"}} like using inline styles in html?
cool! do I need to somehow add my css files to the :require at the top of my view files?
or add them them to project.clj?
or to public/index.html?
should I put css files right in public/css/?
I don’t quite remember how re-frame structures its project (there is a #re-frame channel if you are committed to that framework), but I’m pretty sure that you can just include your css file in the index.html. if you want to just use reagent, you can use the reagent template (https://github.com/reagent-project/reagent-template) and then you can stick your css in resources/public/html/css
(I think). that template also allows you to install sass
or less
if you prefer.
thanks. I was under the impression that the "re-frame" lein starter is basically reagent plus their bit about state
maybe I should have scaffolded it with +less
I put the css in resources/public/css and then added it to the index.html
<link rel="stylesheet" href="./css/styles.css">
that's working for me! would nice to have css automatically picked up though 🙂
somehow i have that working on my template but of course i’ve forgotten how it’s done. why this stuff isn’t automatic is beyond me 🙂