Created
July 4, 2016 17:38
-
-
Save qwtel/b4b5c9675f844c51ff24c3910179d99c to your computer and use it in GitHub Desktop.
Very basic ClojureScript Leiningen setup with cljs-devtools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject hello-world "0.0.0" | |
;; lein obviously does dependency management | |
:dependencies [[org.clojure/clojure "1.8.0"] | |
[org.clojure/clojurescript "1.9.92"]] | |
;; and uses plugins for non-standard tasks | |
:plugins [[lein-cljsbuild "1.1.3"] | |
[lein-figwheel "0.5.4-4"]] | |
;; this will build cljs on `lein compile` | |
:hooks [leiningen.cljsbuild] | |
;; cljsbuild configuraiton | |
;; takes multimple builds (will execute in parallel) | |
;; choosing a name for a build allows to modify it in other profiles (see below) | |
:cljsbuild {:builds {:main {:source-paths ["src"] | |
:compiler {:main hello-world.core | |
:output-to "resources/public/js/main.js" | |
:output-dir "resources/public/js" | |
:asset-path "js"}}}} | |
;; I suggest using profiles from the beginning | |
;; `dev` profile is known to lein and enabled by default | |
:profiles {:dev {:dependencies [[binaryage/devtools "0.7.2"]] | |
:cljsbuild {:builds {:main {:figwheel true | |
:compiler {:optimizations :none | |
:source-map true | |
;; namespace to load before the `:main` namespace | |
:preloads [devtools.preload]}}}}} | |
;; `prod` key is not known to lein, choose any you want | |
:prod {:cljsbuild {:builds {:main {:compiler {:optimizations :advanced | |
:pretty-print false}}}}}} | |
;; `resources/public/js` is a non-standard target folder, so we overwrite `clean-targets` | |
:clean-targets ^{:protect false} ["target" "resources/public/js"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment