Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@borkdude
Created November 19, 2017 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save borkdude/45b0c7e2a49e29c4fa984fcbe0ffbe78 to your computer and use it in GitHub Desktop.
Save borkdude/45b0c7e2a49e29c4fa984fcbe0ffbe78 to your computer and use it in GitHub Desktop.
Boot node hot reloading
(set-env!
:source-paths #{"src/cljs"}
:resource-paths #{"resources"}
:dependencies '[[adzerk/boot-cljs "1.7.228-2" :scope "test"]
[adzerk/boot-cljs-repl "0.3.3" :scope "test"]
;;[adzerk/boot-reload "0.4.13" :scope "test"]
[powerlaces/boot-figreload "0.5.13"]
[pandeiro/boot-http "0.7.6" :scope "test"]
[com.cemerick/piggieback "0.2.1" :scope "test"]
[org.clojure/tools.nrepl "0.2.12" :scope "test"]
[weasel "0.7.0" :scope "test"]
[org.clojure/clojurescript "1.9.293"]
[reagent "0.6.0"]
[org.clojure/clojure "1.8.0"]])
(require
'[adzerk.boot-cljs :refer [cljs]]
'[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]
'[powerlaces.boot-figreload :refer [reload]]
'[pandeiro.boot-http :refer [serve]])
(task-options!
speak {:theme "woodblock"})
(deftask build []
(comp (speak)
(cljs)
))
(deftask run []
(comp #_(serve)
(watch)
(cljs-repl)
(reload)
(build)))
(deftask production []
(task-options! cljs {:optimizations :simple
:compiler-options {;;:main 'reagnarok.app/-main
;;:output-dir "out"
;;:output-to "main.js"
:target :nodejs}})
identity)
(deftask development []
(task-options! cljs {:optimizations :none
:compiler-options {:main 'reagnarok.app/-main
:target :nodejs
;;:output-dir "out"
;;:output-to "main.js"
}
:source-map true
})
identity)
(deftask dev
"Simple alias to run application in development mode"
[]
(comp (development)
(run)))
$ boot dev target
Writing boot_cljs_repl.cljs...
Starting reload server on ws://localhost:54759
Starting file watcher (CTRL-C to quit)...
Retrieving maven-metadata.xml from https://repo.clojars.org/ (1k)
Retrieving maven-metadata.xml from https://repo.clojars.org/ (1k)
nREPL server started on port 54767 on host 127.0.0.1 - nrepl://127.0.0.1:54767
Writing figwheel.connect.build-app-4369e0c2 namespace to build_app_4369e0c2.cljs...
Adding :require(s) to app.cljs.edn...
Compiling ClojureScript...
WARNING: Replacing ClojureScript compiler option :main with automatically set value.
• js/app.js
Writing target dir(s)...
Elapsed time: 25.335 sec
Compiling ClojureScript...
WARNING: Replacing ClojureScript compiler option :main with automatically set value.
• js/app.js
Writing target dir(s)...
Elapsed time: 0.481 sec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment