A Leiningen plugin to compile an scss project to css using CLI tools. Designed to be used with the libsass binary sassc, but should work equally well with any other CLI binary that converts scss to css.
Put [lein-scss "0.3.0"] into the :plugins vector of your project.clj.
Run with:
lein scss <build-keys ...> [once|auto] [boring] [quiet] [beep] [unused]
- The
autooption watches the source directory for changes and automatically compiles them. - The
onceoption will compile all stylesheets and exit. - Add the
boringoption to prevent color output for use in logs. - Add the
quietoption to prevent excessive logging. - Running without these options will compile all stylesheets in the source directory and then wait for changes.
build-keyscan be one or more keywords for builds specified in the project.clj configuration, see below.- Use
unusedto list any partials not present in any of the stylesheets.
An example project.clj would look like this:
(defproject myproject "0.1.0-SNAPSHOT"
:description "My Project"
:dependencies [[org.clojure/clojure "1.8.0"]]
:plugins [[lein-scss "0.3.0"]]
:hooks [leiningen.scss] ;; You can hook scss into the `compile`, `jar` and `uberjar` lein tasks
;; You also have to enable it in a build map - see below.
:scss {:builds
{:develop {:source-dir "scss/"
:dest-dir "public/css/"
:executable "sassc"
:args ["-m" "-I" "scss/" "-t" "nested"]}
:production {:source-dir "scss/"
:dest-dir "public/css/"
:executable "sassc"
:args ["-I" "scss/" "-t" "compressed"]
:jar true}
:testremote {:source-dir "scss/"
:dest-dir "public/css/"
:executable "sassc"
:args ["-I" "scss/" "-t" "nested"]
:image-token "#IMAGE-URL#"
:image-url "https://s3.amazonaws.com/test/"
:font-token "#FONT-URL#"
:font-url "https://s3.amazonaws.com/test/fonts/"}
:test {:source-dir "tests/scss/"
:dest-dir "/tmp/test/css/"
:executable "sassc"
:args ["-m" "-I" "scss/" "-t" "nested"]}}}:source-diris the directory containing your.scsssource files.:dest-diris the directory where.cssfiles will be generated.:executableis the path to your sass conversion binary.:argsis a vector of arguments to add to the executable command. The input and output file arguments will be appended to this list.:jarset totruewill package css in the JAR file.
When specified, :image-token and :font-token will be replaced by :image-url and :font-url in the generated css.
Copyright © 2014
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.