You can do this without compojure. Refer [A minimum setting to use browser REPL of ClojureScript] (https://gist.github.com/kohyama/6183122).
Assumed that you have set leiningen up and can use it.
Copy project.clj
, repl-test.cljs
, minimum_httpd.clj
and repl-test.html
from this gist or git clone this gist.
Move or copy repl-test.cljs
under src-cljs
directory,
minimum_httpd.clj
under src
and
repl-test.html
under resources/public
$ git clone https://gist.github.com/6191281.git
$ cd 6191281/
$ mkdir -p src src-cljs resources/public
$ mv repl-test.cljs src-cljs/
$ mv minimum_httpd.clj src/
$ mv repl-test.html resources/public/
Compile repl-test.cljs
into resources/public/repl-test.js
.
$ lein cljsbuild once
$ lein trampoline cljsbuild repl-listen
Running ClojureScript REPL, listening on port 9000.
"Type: " :cljs/quit " to quit"
ClojureScript:cljs.user>
Do below on another terminal
$ lein ring server
This opens http://localhost:3000/
with a new window or tab of
your default web browser automatically and it fails with 404
because we didn't define the response for /
.
Open resources/public/repl-test.html
on a web browser via the httpd
http://localhost:3000/repl-test.html
It's enough to add repl-test.html
to the address bar of the opened browser.
ClojureScript:cljs.user> (js/alert "Hello world from CLJS REPL!")
If the web browser pops an alert window up, it works.