Skip to content

martinklepsch/boot-garden

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

boot-garden

Boot task to compile Garden stylesheets.

Provides the garden task, which compiles Garden to CSS.

[org.martinklepsch/boot-garden "1.3.2-1"] ;; latest release

Usage

Lets assume you have a styles.clj as follows:

(ns my-project.styles
  (:require [garden.def :refer [defrule defstyles]]
            [garden.stylesheet :refer [rule]]))

(defstyles base
  (let [body (rule :body)]
    (body
     {:font-family "Helvetica Neue"
      :font-size   "16px"
      :line-height 1.5})))

Terminal

In a terminal you can compile any defstyles-defined stylesheet as follows:

boot garden -s my-project.styles/base

To regenerate stylesheets on changes you can use boot's generic watch task:

boot watch garden -s my-project.styles/base

build.boot file in your project

In your build.boot you could call it like this:

(deftask run
  "Generate CSS from Garden and watch for future changes"
  []
  (comp (watch) (garden :styles-var 'my-project.styles/screen)))

Options

See the boot project for more information on how to use these. To view these options on the command line, use boot garden --help.

[o output-to PATH      str   "The output css file path relative to docroot"
 s styles-var SYM      sym   "The var containing garden rules"
 p pretty-print        bool  "Pretty print compiled CSS"
 v vendors VENDORS     [str] "Vendors to apply prefixes for"
 c css-prepend PREPEND [str] "Raw CSS from resources to be prepended to the output"
 a auto-prefix PREFIX  #{kw} "Properties to auto-prefix with vendor-prefixes"]

By default boot-garden will materialize the compiled CSS file on the fileset, and, as per Boot's FAQ, will save it to target/main.css only when the target task ends the pipeline.

License

Copyright Martin Klepsch 2014.

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.