Boot task providing a ClojureScript browser REPL via weasel.
Add boot-cljs-repl
to your build.boot
dependencies and require
the
namespace:
(set-env! :dependencies '[[adzerk/boot-cljs-repl "X.Y.Z" :scope "test"]])
(require '[adzerk.boot-cljs-repl :refer :all])
You can see the options available on the command line:
boot cljs-repl -h
or in the REPL:
boot.user=> (doc cljs-repl)
A typical boot.build
file for ClojureScript development:
(set-env!
:src-paths #{"src"}
:dependencies '[[adzerk/boot-cljs "0.0-X-Y" :scope "test"]
[adzerk/boot-cljs-repl "X.Y.Z" :scope "test"]])
(require
'[adzerk.boot-cljs :refer :all]
'[adzerk.boot-cljs-repl :refer :all])
When compiling with optimization level none
and you're not using the -u
option with the cljs
task you must add a script tag to the page HTML to
connect the client to the REPL server:
<!-- Note: This is only needed when optimization level is :none
and the -u (--unified) option is not specified for the cljs task. -->
<script type="text/javascript">goog.require('adzerk.boot_cljs_repl');</script>
Start a build pipeline with file-watcher, start ClojureScript REPL, and compile ClojureScript with source maps, unified HTML loading, and no optimizations:
# note: cljs-repl task must precede cljs task
boot watch cljs-repl cljs -usO none
To start the CLJS REPL you must connect to the running REPL server. In the terminal you can do:
boot repl -c
but you can also connect from other REPL clients, like via cider in Emacs, for example:
M-x cider RET RET RET
If cider can't figure out which port the server is listening on you may inspect the
.nrepl-port
file in the project directory.
In the connected REPL client do:
boot.user=> (start-repl)
Or if you are using Vim and fireplace.vim, use the command :Piggieback (boot.user/repl-env)
.
Load your page in a browser. Boom. REPL.
Copyright © 2014 Adzerk
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.