search


ClojureScript Development with Shadow.cljs
Mon Mar 06 00:00:00 UTC 2023

Shadow CLJS makes it easy to use javascript libraries from ClojureScript

Shadow CLJS has two REPLs. A clj REPL and a cljs REPL. First start the clj REPL as follows:

% npx shadow-cljs clj-repl

shadow-cljs - config: /Users/sto/workspace/reagent/examples/material-ui/shadow-cljs.edn
shadow-cljs - updating dependencies
shadow-cljs - dependencies updated
shadow-cljs - HTTP server available at http://localhost:3000
shadow-cljs - server version: 2.19.9 running at http://localhost:9630
shadow-cljs - nREPL server started on port 3333
shadow-cljs - REPL - see (help)
To quit, type: :repl/quit


Now that you have nrepl running, you can connect to it from emacs with M-x cider-connect. Enter localhost and port. Once connected to nrepl, call the following function to start watching from cljs changes and then start the cljs REPL


shadow.user=>(shadow/watch :app)
shadow.user=>(shadow/repl :app) ;;start cljs REPL

Now you can evaluate ClojureScript code from emacs. If you cannot, it means you're haven't started the cljs REPL or you started the cljs REPL from the shell and not from nREPL via cider-connect

Refer to Shadow CLJS User's Guide for additional documentation