@@ -30,7 +30,7 @@ to connect to an already running nREPL server using
30
30
31
31
To setup piggieback, add the following dependencies to your project
32
32
(`project.clj` in a Leiningen based project or `build.boot` in a Boot
33
- project):
33
+ project or `deps.edn` ):
34
34
35
35
[source,clojure]
36
36
----
@@ -56,11 +56,21 @@ or in `build.boot`:
56
56
repl {:middleware '[cider.piggieback/wrap-cljs-repl]})
57
57
----
58
58
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
+
59
68
== Starting a ClojureScript REPL
60
69
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.
64
74
65
75
NOTE: Prior to CIDER 0.18, `cider-jack-in-cljs` would create both a Clojure and
66
76
a 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
99
109
100
110
[source,lisp]
101
111
----
102
- ;; replace the list of REPLs types and set some default
112
+ ;; replace the list of REPL types and set some default
103
113
((nil
104
114
(cider-default-cljs-repl . super-cljs)
105
115
(cider-cljs-repl-types . ((super-cljs "(do (foo) (bar))")))))
@@ -130,7 +140,7 @@ ClojureScript REPL, you can invoke
130
140
== Setting up a ClojureScript REPL
131
141
132
142
The following sections describe the configurations for several common
133
- CloudScript REPL use cases.
143
+ ClojureScript REPL use cases.
134
144
135
145
=== Browser-Connected ClojureScript REPL
136
146
@@ -233,6 +243,11 @@ them to your favourite build tool is up to you.
233
243
234
244
You can also use https://github.com/bhauman/figwheel-main[Figwheel-main] with CIDER.
235
245
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
+
236
251
. Add this to your dev `:dependencies` (not needed for `cider-jack-in-cljs`):
237
252
+
238
253
[source,clojure]
@@ -248,9 +263,57 @@ You can also use https://github.com/bhauman/figwheel-main[Figwheel-main] with CI
248
263
----
249
264
+
250
265
. 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`.
252
267
. Select the Figwheel build to run when prompted for it. (e.g. `:dev`).
253
268
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
+
254
317
=== Using shadow-cljs
255
318
256
319
Provided you've configured your project correctly, you can simply use
0 commit comments