-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
To install the Starter Kit, clone its git repository and the ClojureScript repository.
Clone and setup clojurescript
:
git clone git://github.com/clojure/clojurescript.git
cd clojurescript
script/bootstrap
In the same directory, clone and setup clojurescript-starter-kit
:
git clone [email protected]:brentonashworth/clojurescript-starter-kit.git
cd clojurescript-starter-kit
lein deps
If clojurescript
and clojurescript-starter-kit
are not located in the same directory then the CLOJURESCRIPT_HOME environment variable must be set.
From within the clojurescript-starter-kit
directory, the server may be run from the command line with script/run
and a properly classpathed Clojure REPL can be started with script/repl
. From the Clojure REPL, the server can be started by evaluating:
(use 'start.dev-server)
(run-server)
A ClojureScript REPL allows you to evaluate forms in the running ClojureScript application. Starting a working ClojureScript REPL is a two step process. You first need to start the REPL process and then you need to connect it to the browser. The REPL will not work until it has connected to a browser. To connect, visit http://localhost:8080
and click the Development button. If you are already on this page then you will need to refresh it. Whenever you start a ClojureScript REPL you will need to either go to or refresh this page. The ClojureScript REPL will only work when running the development version of the application. The design view does not do anything and the production view does not connect to the REPL.
A ClojureScript REPL can be started by evaluating:
(cljs-repl)
With your browser window in view, evaluate the following forms to ensure that you are connected and to experience some of the joy of ClojureScript.
(js/alert "hello")
(in-ns 'start.view)
(dom/set-value :name-input "Dan")
(dom/click-element :greet-button)
Entering :cljs/quit
in the ClojureScript REPL will stop this REPL and put you back in the Clojure REPL. In this way, one can quickly switch between the Clojure and ClojureScript REPL when working on the client and server portions of an application.