Cljss provides a DSL to write CSS as clojure data, similar to css-gen in the 0.3.0 branch. More precisely the rules syntax more or less the same syntax as css-gen with somme tricks of my own.
Quick example:
(use 'cljss.core)
(css [[:section :div#someid]
:width :900px
:transform #{(rotate :90deg)
(translate :20px :30px)}
:transform-origin [:bottom :left]
:border [:1px :solid :black]
[(-> & hover)
:color :blue]])
generates:
section div#someid {
border: 1px solid black;
transform: translate(20px, 30px), rotate(90deg);
transform-origin: bottom left;
width: 900px;
}
section div#someid:hover {
color: blue;
}
In project.clj
:
[jeremys/cljss-core "0.3.0"]
Obviousily thanks to @paraseba for the ideas I used from css-gen.
A thanks to Kodowa too, I'm having a very good time writing this code with Ligh Table !
- add optional indenting in the output.
- ClojureScript adaptation ?
- syntax checking / error reporting ?
Copyright © 2013 Jérémy Schoffen.
Distributed under the Eclipse Public License, the same as Clojure.