A Leiningen plugin for concatenating and compressing files.
Good for your .css files (reduce page load time by cutting down on asset loading calls).
Possibly good for your .js files (good use cases are compiled .coffee files and natural .js files).
This plugin will concatenate anything, but for now the only available compressor is YuiCompressor, and only for css (there's some crazy rhino version dependency issue with js parsing).
-
To get this at the user level, just follow the usual Leiningen instructions:
- For Leiningen 2: Put
[lein-aggravate "0.1.0-SNAPSHOT"]into the:pluginsvector of your:userprofile. - For Leiningen 1: Do
lein plugin install lein-aggravate 0.1.0-SNAPSHOT.
- For Leiningen 2: Put
-
For your individual project:
- Put
[lein-aggravate "0.1.0-SNAPSHOT"]into the:pluginsvector of yourproject.clj.
- Put
There are two optional fields that you can add to your project.clj, aggravate-files and aggravate-dirs.
The following is a somewhat contrived usage example:
:aggravate-files [{:input ["foo/bar.css" "foo/baz.css"]
:output "foo/compiled-files/main.css"
:compressor "yui"}
{:input ["messed/up.css" "messed/up/more.css"]
:output "foo/compiled-files/messed.css"}]
:aggravate-dirs [{:input ["foo"]
:output "foo/compiled-dirs/main.css"
:suffix "css"
:compressor "yui"}]- In both cases, the only required settings are
:inputand:output. :aggravate-dirsrecursively fetches all files in or below the specified directory (usesfile-seq)- The
:suffixoption for:aggravate-dirsmaps will filter the files it finds. - Currently the only available option for
:compressoris"yui", and note that this should only be used oncssfiles.
You can run aggravate in your project with:
$ lein aggravate
You can also have aggravate run after the rest of your Leiningen project compiles by adding the following to your project.clj:
:hooks [leiningen.aggravate]##TODOS
-
Unit tests
-
Some form of CI (Travis?)
-
Add a compressor for
js -
Learn to write better clojure
-
Learn to write better READMEs
Copyright © 2012 Ben Yelsey
Distributed under the Eclipse Public License, the same as Clojure.