A Leiningen plugin for compiling garden to css.
Add lein-garden to plugins section in project.clj
:
:plugins [[org.clojars.nbeloglazov/lein-garden "0.1.0-SNAPSHOT"]]
Add garden config to project.clj
:
:garden {:source-path "src/garden"
:output-path "resources/css"}
lein-garden provides 2 tasks:
lein garden once
- compiles garden files to css oncelein garden auto
- compiles garden files to css on every change
Garden files are usual clojure files (*.clj). Plugin reads all expressions from clj files, evaluates them, retains vectors and garden.types.CSSAtRule values and compiles them to css.
simple.clj
[:body {:font-size "16px"}]
[:h1 :h2 {:font-weight "none"}]
[:h1 [:a {:text-decoration "none"}]]
[:h1 :h2 [:a {:text-decoration "none"}]]
[:h1 :h2 {:font-weight "normal"}
[:strong :b {:font-weight "bold"}]]
[:a
{:font-weight 'normal
:text-decoration 'none}
[:&:hover
{:font-weight 'bold
:text-decoration 'underline}]]
complex.clj
(require '[garden.color :as color :refer [rgb]]
'[garden.units :refer [px]]
'[garden.stylesheet :refer [at-media]])
(def font-color-active (rgb 0 0 0))
(def font-color-inactive (color/lighten font-color-active 50))
[:body :p
{:color font-color-active}
[:.inactive
{:color font-color-inactive}]]
(at-media {:min-width (px 768) :max-width (px 979)}
[:container {:width (px 960)}])
Check examples project.
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.