Skip to content

Instantly share code, notes, and snippets.

@arichiardi
Last active Nov 11, 2017
Embed
What would you like to do?
Data oriented defedntask for boot-clj, sample (macro not included)
(def env-web-prod {:resource-paths #{"resources"}
:source-paths #{"src/web" "src/shared"}
:dependencies '[[org.clojure/clojure "1.9.0-alpha14"]
[adzerk/boot-cljs "2.0.0-SNAPSHOT" :scope "test"]
[org.clojure/clojurescript "1.9.456" :scope "test"]
[org.clojure/test.check "0.9.0"] ;; AR - at the moment we need it, see http://dev.clojure.org/jira/browse/CLJS-1792
[adzerk/env "0.4.0"]
[binaryage/oops "0.5.2"]
[cljsjs/d3 "4.3.0-3"]
[cljsjs/intersections "1.0.0-0"]
[reagent "0.6.0"]]})
(def conf-web-prod {:env env-web-prod
:pipeline '(adzerk.boot-cljs/cljs)
:cljs {:source-map true
:optimizations :advanced
:compiler-options {:closure-defines {"goog.DEBUG" false}
;; :elide-asserts true
:pseudo-names true ;; TODO set to false for prod
:pretty-print false
:source-map-timestamp true
:parallel-build true
:verbose true
:compiler-stats true}}})
(def env-web-dev (update env-web-prod :dependencies
into
'[[powerlaces/boot-figreload "0.1.0-SNAPSHOT" :scope "test"]
[adzerk/boot-cljs-repl "0.3.3" :scope "test"]
[com.cemerick/piggieback "0.2.1" :scope "test"]
[weasel "0.7.0" :scope "test"]
[org.clojure/tools.nrepl "0.2.12" :scope "test"]
[binaryage/devtools "0.8.3" :scope "test"]
[powerlaces/boot-cljs-devtools "0.1.3-SNAPSHOT" :scope "test"]
[pandeiro/boot-http "0.7.6" :scope "test"]
[crisptrutski/boot-cljs-test "0.2.2" :scope "test"]]))
(def conf-web-dev
{:env env-web-dev
:pipeline '(comp (pandeiro.boot-http/serve)
(watch)
(powerlaces.boot-cljs-devtools/cljs-devtools)
(powerlaces.boot-figreload/reload)
(adzerk.boot-cljs-repl/cljs-repl)
(adzerk.boot-cljs/cljs))
:reload {:client-opts {:debug true}}
:cljs-repl {:nrepl-opts {:port 5088}}
:cljs {:source-map true
:optimizations :none
:compiler-options {:external-config
{:devtools/config {:features-to-install [:formatters :hints]
:fn-symbol "λ"
:print-config-overrides true}}}}})
(boot/defedntask build-web
"Build the web artifact with production configuration"
[]
conf-web-prod)
(boot/defedntask dev-web
"Start the web interactive environment"
[f foo-mode bool "Enable foo."] ;; options to tasks are allowed
(if foo-mode
(-> conf-web-dev
(update-in [:env :source-paths] into "dev")
(assoc-in [:cljs :optimizations] foo-mode))
conf-web-dev))
@teaforthecat
Copy link

teaforthecat commented Nov 11, 2017

This looks interesting, were's the macro?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment