Skip to content

Getting started

suryagaddipati edited this page Feb 7, 2012 · 21 revisions

Getting Started

To install ClojureScript One, install leiningen, 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 server, and start a browser that opens to http://localhost:8080.

Getting an exception when you run lein repl?

If you get an exception when you run lein repl, try this workaround.

Clojure REPL

The command lein repl will start a properly classpathed Clojure Read-eval-print-loop (REPL). To start the development server, you can then type (dev-server) at the prompt which appears.

To interact with the running ClojureScript application, you will need to start a ClojureScript REPL. To start the development server, a ClojureScript REPL, and open a browser to http://localhost:8080, type (go) instead of (dev-server).

About the ClojureScript REPL

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.

Testing your connection

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 '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.

Clone this wiki locally