A Starter ClojureScript Project
It is mostly based on information gleaned from the second edition of Modern CLJS - the excellent tutorial by Mimmo Cosenza.
Other information is from
This is project is set up for Cider version 0.14.0, make sure you’ve installed that first. Here’s some configuration for Cider:
(with-eval-after-load "cider" (setq cider-jack-in-lein-plugins nil) (setq cider-jack-in-dependencies nil) ;; These should probably not be here, but done with M-x customize ;; instead. (setq cider-boot-parameters "dev") (setq cider-cljs-lein-repl "(start-repl)"))
We set the plugins and the dependencies to nil because the build.boot file contains specifications for all the libraries needed. Cider can inject them automatically, but I couldn’t get things working that way. Note that even though the variable is called lein-plugins, it is also used for Boot projects. Then we make sure Cider uses the Boot task named “dev”, which is also defined in build.boot. This task is configured to start everything up - Clojure, a web server and the ClojureScript compiler. Lastly we set the command Cider should use (once it has connected to the Clojure repl) to start the ClojureScript repl.
Then, to get a running browser connected repl, open one of the files
in the project, for example core.cljs. Run
cider-jack-in-clojurescript, and wait a little while. Two repl
windows will appear, and Emacs will ask if you want to open your
browser. On my computer at least, I need to wait at least 20 seconds
or so for everything to finish starting up and compiling, before
answering yes to this question. The browser should start, and you
should see “connected!” in one of the repls. This is now your browser
connected ClojureScript repl (the other repl is for the underlying
Clojure process.) In the ClojureScript repl you can now type something
(js/alert "Hello, World!") and see the result in your browser.
Copyright © Andrew Cowper, 2017. Released under the Eclipse Public License, the same license as Clojure.