-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
To install ClojureScript One, install
leiningen [note version 1.7.0 needed], clone
ClojureScript One and, from within the cloned directory, run lein bootstrap
.
git clone https://github.com/brentonashworth/one.git
cd one
lein bootstrap
lein repl
(go)
The commands above will install everything, start the development server, start a ClojureScript REPL and launch a browser that opens to http://localhost:8080.
If you get an exception when you run lein repl
, try this workaround.
The command lein repl
will start a properly classpathed Clojure
Read-Eval-Print-Loop
(REPL).
To start the development server, type (dev-server)
at the prompt which appears.
This will start the development server and open a browser to http://localhost:8080
To interact with the running ClojureScript application, you will need to start a ClojureScript REPL.
To start a ClojureScript REPL, type (go)
instead of (dev-server)
at the prompt which appears after lein repl
This will start a ClojureScript REPL as well as the development server, and open a browser to http://localhost:8080.
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. 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. Each time 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. Neither the design nor the production view connects to the REPL.
With your browser window in view, evaluate the following forms in the ClojureScript REPL to ensure that you are connected and to experience some of the joy of ClojureScript.
(js/alert "hello")
(in-ns 'one.sample.view)
(set-text! (by-id "header") "The Form")
(set-styles! (by-id "header") {:color "#FF0000" :font-size "138px"})
Entering :cljs/quit
in the ClojureScript REPL will stop this REPL
and put you back in the Clojure REPL. To re-enter the ClojureScript
REPL, simply type (cljs-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. Remember that you will need to
refresh the development view in the browser every time you start a new
ClojureScript REPL.