Skip to content

Project organization

Brenton Ashworth edited this page Dec 4, 2011 · 11 revisions

Project organization

There are only three top level directories in this project that a designer or developer will need to work with: public, templates and src.

public

public
├── 404.html
├── css
├── design.html
├── images
├── index.html
└── javascripts

The public directory contains files that are publicly available. With a running server, 404.html can be reached at http://localhost:8080/404.html.

JavaScripts generated by the ClojureScript compiler will be put into public/javascripts. Images and CSS should be put into public/images and public/css.

A designer may also want to change the links on the design page. This can be done by editing the public/design.html file and following the conventions in that file..

templates

templates
├── application.html
├── form.html
├── greeting.html
└── toolbar.html

The templates directory contains template HTML files which will become part of the running application. See the Design and templating page for more information about how to use these templates.

src

src
├── clj
│   ├── library
│   │   ├── ...
│   └── start
│       ├── ...
├── cljs
│   ├── library
│   │   ├── browser
│   │   │   ├── ...
│   │   ├── ...
│   └── start
│       ├── ...
└── cljs-macros
    └── start
        └── ...

Source files are organized into three directories: clj, cljs andcljs-macros. Clojure and ClojureScript code go into clj and cljsrespectively. ClojureScript macros are Clojure macros and go intocljs-macros. Both macros and functions from files in cljs-macros can be used in Clojure code and the macros can be used in ClojureScript code.

Other interesting directories

Any code in a namespace which starts with library is plumbing code and is not specific to this particular application. It is the type of code that should be put into an external library.

src/clj/library

The src/clj/library directory contains code for configuration, code reloading, templating, testing, creating a JavaScript host page and building deployment artifacts.

src/clj/start

The src/clj/start directory contains a development and deployment server, the application configuration and the server-side API for the sample application.

src/cljs/library

The src/cljs/library directory contains code for event dispatching and logging.

src/cljs/library/browser

The src/cljs/library/browser directory contains code for dealing with browser history and remoting.

src/cljs/start

The src/cljs/start directory contains the sample ClojureScript application. It is a simple form which prints a greeting when submitted. The application demonstrates using the event dispatcher, history, remoting and logging.

test

Contains tests for the sample application. The most interesting tests are contained in start.test.integration.`

Clone this wiki locally