Skip to content

Getting started

pastafari edited this page Feb 27, 2012 · 21 revisions

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.

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, type (dev-server) at the prompt which appears.
This will start the development server and open a browser to http://localhost:8080

ClojureScript REPL

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.

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

Clone this wiki locally