/cljss-core

A Clojure CSS DSL.

Primary LanguageClojure

cljss

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;
  }

Installation

In project.clj:

[jeremys/cljss-core "0.3.0"]

Documentation

Thanks

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 !

Todo

  • add optional indenting in the output.
  • ClojureScript adaptation ?
  • syntax checking / error reporting ?

License

Copyright © 2013 Jérémy Schoffen.

Distributed under the Eclipse Public License, the same as Clojure.