I am creating a Clojure / ClojureScript site that I am deploying to Heroku. I use Leiningen for project management.
I want to write styles in LESS. I need a build process to compile LESS files into CSS, and then minimize these CSS files; obviously, I don't want the generated CSS files to be versioned.
Smaller files - lein-less→ CSS files - lein-asset-minifier→ miniature CSS files
I tried to implement it with the help lein-lessand lein-asset-minifierLeiningen plugins. My attempt consisted of declaring leiningen.lessand minify-assets.plugin/hookshooking tasks :uberjarin the correct order (see Code below). But the execution lein uberjarfails with the following error:
Uberjar aborting because jar failed: resources/public/css/site.css (No such file or directory)
Therefore, the order in which the steps are performed is not performed.
Is it possible to implement this multi-stage build with these Leiningen plugins? If not, how do people do it?
the code
Here is the relevant part of mine project.clj:
(defproject sncf-cljs "0.1.0-SNAPSHOT"
;; ...
:min-lein-version "2.5.0"
:source-paths ["src/clj" "src/cljs"]
:dependencies [
;; ...
]
:plugins [
[lein-cljsbuild "1.0.4"]
[lein-environ "1.0.0"]
[lein-ring "0.9.1"]
[lein-asset-minifier "0.2.2"]
[lein-less "1.7.2"]]
:less {:source-paths ["src/less"]
:target-path "resources/public/css"}
:uberjar-name "sncf-cljs.jar"
:minify-assets {:assets
{"resources/public/css/site.min.css" "resources/public/css/site.css"}}
:cljsbuild {
;; ...
}
:profiles {
;; ...
:uberjar {:hooks [leiningen.less
leiningen.cljsbuild
minify-assets.plugin/hooks]
:env {:production true}
:aot :all
:omit-source true
:cljsbuild {:jar true
:builds {:app
{:source-paths ["env/prod/cljs"]
:compiler
{:optimizations :advanced
:pretty-print false}}}}}
:production {:ring {:open-browser? false
:stacktraces? false
:auto-reload? false}
:cljsbuild {:builds {:app {:compiler {:main "sncf-cljs.prod"}}}}
}})
source
share