- Create an app following the official Shadow-CLJS Quick Start instructions.
- Modify
shadow-cljs.edn
;; shadow-cljs configuration
{:source-paths
["src/dev"
"src/main"
"src/test"]
;; ADD - CIDER middleware for nREPL (required by fireplace.vim)
:dependencies
[[cider/cider-nrepl "0.22.4"]]
;; ADD - a port for nREPL to which fireplace.vim connects
:nrepl
{:port 3333}
;; ADD - a port for the developmemt-time HTTP server that serves the app
:dev-http
{8080 "public"}
:builds
{:frontend ; NOTE - This is the build ID referenced at various places below.
{:target :browser
:modules {:main {:init-fn acme.frontend.app/init}}}}}
- Start the app (note the build ID,
frontend
)
npx shadow-cljs watch frontend
- Open the app in a browser at http://localhost:8080/. Without this step, you would get the following error:
No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.
- Open a ClojureScript source file in Vim/Neovim
~/code/clojurescript/acme-app $ vi src/main/acme/frontend/app.cljs
- Connect fireplace.vim to nREPL (which is Clojure REPL) at port
3333
:Connect 3333
=>
Connected to nrepl://localhost:3333/
Scope connection to: ~/code/clojurescript/acme-app (ENTER)
- Add ClojureScript support to the Clojure nREPL session (note the build ID,
frontend
)
:CljEval (shadow/repl :frontend)
=>
To quit, type: :cljs/quit
[:selected :frontend]
Press ENTER or type command to continue
- You should be able to use regular fireplace.vim commands to do REPL-driven development now.