Fork me on GitHub
#css
<
2017-11-03
>
chadhs13:11:38

so here’s a goofy question, how do you reference the css that garden generates, like say in a hiccup template?

chadhs13:11:20

how to use/consume seems to be omitted from the docs/wiki unless i’m missing it. thnx

chadhs14:11:09

perhaps a better question is… > what is a common preferred pattern for how/where to define your css with garden and consume/inject it?

niamu15:11:14

The lazy answer is to do what traditionally has always been done with CSS which is just knowing what IDs and classes are available and referencing those when writing your markup.

niamu15:11:05

I usually create a style.cljc namespace in my project and create a route that will serve the rendered CSS rather than spitting it out to a file which makes code reloading a bit of a pain.

niamu15:11:42

Then I’ll have a reference to that route path in my HTML structure in the <head>.

chadhs15:11:08

yeah i’ve read that article, and it’s good, just handy to see actual example implementations

chadhs15:11:20

ah cool, this is helpful thanks.

chadhs15:11:29

you’re creating a stylesheet

chadhs15:11:50

then you’re defining a render function that calls garden/css on that stylesheet

chadhs15:11:15

and i see the call to style/render in your response :body

niamu15:11:42

Right. So that way any changes to the style.cljc namespace during development always gives me the latest CSS in the route rather than having to spit out a new file of the rendered CSS.