css 2017-11-03

@chadhs has joined the channel

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

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

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

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.

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.

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

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

ah cool, this is helpful thanks.

you’re creating a stylesheet

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

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

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.