@@ -30,7 +30,7 @@ to connect to an already running nREPL server using
3030
3131To setup piggieback, add the following dependencies to your project
3232(`project.clj` in a Leiningen based project or `build.boot` in a Boot
33- project):
33+ project or `deps.edn` ):
3434
3535[source,clojure]
3636----
@@ -56,11 +56,21 @@ or in `build.boot`:
5656 repl {:middleware '[cider.piggieback/wrap-cljs-repl]})
5757----
5858
59+ or in `deps.edn`:
60+
61+ [source,clojure]
62+ ----
63+ {:aliases { :cider-cljs { :main-opts
64+ ["-m" "nrepl.cmdline" "--middleware"
65+ "[cider.nrepl/cider-middleware,cider.piggieback/wrap-cljs-repl]"]}}}
66+ ----
67+
5968== Starting a ClojureScript REPL
6069
61- Open a file in your project and type kbd:[M-x]
62- `cider-jack-in-cljs` kbd:[RET]. This will start up the nREPL
63- server and create a ClojureScript REPL buffer.
70+ Open a ClojureScript file in your project and type kbd:[M-x]
71+ `cider-jack-in-cljs` kbd:[RET]. With the correct configuration
72+ and after answering a few prompts this will start up the
73+ nREPL server and create a ClojureScript REPL buffer.
6474
6575NOTE: Prior to CIDER 0.18, `cider-jack-in-cljs` would create both a Clojure and
6676a ClojureScript REPL. In CIDER 0.18+ if you want to create both REPLs
@@ -99,7 +109,7 @@ You can also modify the known ClojureScript REPLs on a per-project basis using
99109
100110[source,lisp]
101111----
102- ;; replace the list of REPLs types and set some default
112+ ;; replace the list of REPL types and set some default
103113((nil
104114 (cider-default-cljs-repl . super-cljs)
105115 (cider-cljs-repl-types . ((super-cljs "(do (foo) (bar))")))))
@@ -130,7 +140,7 @@ ClojureScript REPL, you can invoke
130140== Setting up a ClojureScript REPL
131141
132142The following sections describe the configurations for several common
133- CloudScript REPL use cases.
143+ ClojureScript REPL use cases.
134144
135145=== Browser-Connected ClojureScript REPL
136146
@@ -233,6 +243,11 @@ them to your favourite build tool is up to you.
233243
234244You can also use https://github.com/bhauman/figwheel-main[Figwheel-main] with CIDER.
235245
246+ ==== Leiningen figwheel-main setup
247+
248+ NOTE: This setup is only necessary if `cider-inject-dependencies-at-jack-in` has
249+ been changed from its default setting of `enabled`, as described more fully above.
250+
236251. Add this to your dev `:dependencies` (not needed for `cider-jack-in-cljs`):
237252+
238253[source,clojure]
@@ -248,9 +263,57 @@ You can also use https://github.com/bhauman/figwheel-main[Figwheel-main] with CI
248263----
249264+
250265. Start the REPL with `cider-jack-in-cljs` (kbd:[C-c C-x (C-)j (C-)s]). When CIDER prompts about the ClojureScript REPL type,
251- type `figwheel-main`.
266+ select `figwheel-main`.
252267. Select the Figwheel build to run when prompted for it. (e.g. `:dev`).
253268
269+ ==== Clojure CLI figwheel-main setup
270+
271+ . Ensure your `deps.edn` contains these dependencies available from an
272+ alias such as `fig`. These should already be present if you used the
273+ https://github.com/bhauman/figwheel-main-template[figwheel-main-template]
274+ with https://github.com/seancorfield/clj-new[clj-new] to generate your
275+ deps.edn.
276+ +
277+ [source,clojure]
278+ ----
279+ { :aliases {:fig {:extra-deps
280+ {com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
281+ com.bhauman/figwheel-main {:mvn/version "0.2.3"}}}}}
282+ ----
283+ +
284+ . Add this option to your project's `.dir-locals.el` before opening the
285+ ClojureScript file in a buffer from which you'll be starting the REPL.
286+ (If the file is already open you can either close and open it again or
287+ use `revert-buffer`.)
288+ +
289+ [source,lisp]
290+ ----
291+ ((clojurescript-mode . ((cider-clojure-cli-global-options . "-A:fig"))))
292+ ----
293+ +
294+ . Start the REPL with `cider-jack-in-cljs` (kbd:[C-c C-x (C-)j (C-)s]).
295+
296+ NOTE: If you didn't setup `.dir-locals.el` you can edit the command-line
297+ in the minibuffer and insert "-A:fig" at the beginning after the `clojure`
298+ executable. To do this prepend calling `cider-jack-in-cljs` with the
299+ universal argument (e.g. C-u).
300+
301+ . When CIDER prompts for the ClojureScript REPL type, select `figwheel-main`.
302+ . When CIDER prompts for the build name, select one of the build name
303+ options which were generated by finding files named <build>.cljs.edn in
304+ the project root directory.
305+
306+ WARNING: If instead of selecting one of the build name options provided,
307+ you enter either a non-existent build name (no matching .cljs.edn file)
308+ or an empty build name, CIDER will forward that on to figwheel-main which
309+ will report an error.
310+
311+ NOTE: For more advanced usage, you can provide any options supported
312+ by `figwheel.main/start` at either the prompt for the build name or
313+ using the `cider-figwheel-main-default-options`.
314+ See https://github.com/bhauman/figwheel-main/blob/master/src/figwheel/main/api.clj[figwheel.main.api/start]
315+ for details.
316+
254317=== Using shadow-cljs
255318
256319Provided you've configured your project correctly, you can simply use
0 commit comments