-
-
Notifications
You must be signed in to change notification settings - Fork 208
Running figwheel in a Cursive Clojure REPL
This has been tested with the following versions (but may work with other versions as well):
figwheel "0.3.6"
figwheel-sidecar "0.3.6"
cursive clojure 0.1.56
clojure 1.7.0
clojurescript 0.0-3308
These are the steps you need to take to get a ClojureScript figwheel REPL going in Intellij: (see full details below)
- Create a figwheel project and tweak your
project.clj
- Create a
script/repl.clj
file - Create a
clojure.main
Cursive REPL Configuration
Create a new ClojureScript project based on the figwheel template by
running lein new figwheel figwheel-test
in your terminal.
This will create a figwheel project called figwheel-test
based
on the figwheel
template.
cd
into your project's newly created dir and in the
project.clj
remove lein-figwheel
from :plugins
. Change
your :dependencies
to include figwheel
and figwheel-sidecar
:
Your :dependencies
and :plugins
should look like the following:
(defproject figwheel-test "0.1.0-SNAPSHOT"
...
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "0.0-3308"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[figwheel "0.3.6"]
[figwheel-sidecar "0.3.6"]]
:plugins [[lein-cljsbuild "1.0.5"]]
...)
Create a script/repl.clj
file, it's contents should look like the
following:
(use 'figwheel-sidecar.repl-api)
(start-figwheel! {:all-builds (figwheel-sidecar.repl/get-project-cljs-builds)})
(cljs-repl)
- Click Run->Edit configurations.
- Click the
+
button at the top left and choose Clojure REPL - Enter a name in the Name field (e.g. "REPL")
- Choose the radio button Use clojure.main in normal JVM process
- In the Parameters field put
script/repl.clj
- Click the OK button to save your REPL config.
In Intellij make sure your REPL config is selected and click the green "play" button to start your REPL.
You should see the following if everything is working correctly:
Focusing on build ids: dev
Figwheel Controls:
(stop-autobuild) ;; stops Figwheel autobuilder
(start-autobuild [id ...]) ;; starts autobuilder focused on optional ids
(switch-to-build id ...) ;; switches autobuilder to different build
(reset-autobuild) ;; stops, cleans, and starts autobuilder
(build-once [id ...]) ;; builds source one time
(clean-builds [id ..]) ;; deletes compiled cljs target files
(fig-status) ;; displays current state of system
(add-dep [org.om/om "0.8.1"]) ;; add a dependency. very experimental
Switch REPL build focus:
:cljs/quit ;; allows you to switch REPL to another build
Docs: (doc function-name-here)
Exit: Control+C or :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when figwheel connects to your application
Type `:cljs/quit` to stop the ClojureScript REPL