Skip to content

Yeoman generator for webapps utilizing ClojureScript on the front-end and back-end.

License

Notifications You must be signed in to change notification settings

johntrimble/generator-cljs-fullstack

Repository files navigation

Cljs Full Stack Build Status

Yeoman generator for building web applications leveraging ClojureScript on both the front-end and back-end.

Features:

  • Livereload of client and server files
  • Easy distribution generation
  • Stack traces with source maps applied in Node.js
  • Support for testing using Specljs
  • Support for Sass and Compass

Requirements

Usage

First, install the generator:

npm install -g generator-cljs-fullstack

If you want to do development on the generator itself, do this instead:

git clone https://github.com/johntrimble/generator-cljs-fullstack.git
cd generator-cljs-fullstack
npm install
npm link

Then create a new project by executing the following:

mkdir my-project
cd my-project
yo cljs-fullstack <app-name>

Development

From the project root, execute the following:

grunt serve

This will:

  • Compile ClojureScript source
  • Compile Sass source
  • Start a node server running backend code at http://localhost:4000
  • Start a static content server at http://localhost:9000
    • Proxies http://localhost:9000/api/ to http://localhost:4000/api/
    • Live reloads the browser on content changes (updating ClojureScript code, HTML, CSS, etc.)

Assuming there are no errors, this task should automagically open up a browser window to http://localhost:9000.

If you'd like to have your tests run continuously in the background as well, use the --with-tests options:

grunt serve --with-tests

Distribution

From the project root, execute the following:

grunt

This will:

  • Compile ClojureScript server source
  • Compile ClojureScript client source with advanced mode
  • Compile Sass source
  • Concatenate and minify JavaScript source
  • Minify HTML source
  • Put all backend assets under dist
  • Put all frontend assets under the dist/public directory
  • Generate a suitable package.json at dist/package.json

Assuming there are no errors, the dist directory will be a self contained distribution of the application. The application can be started by running the following:

cd dist
npm install
npm start

Testing

From the project root, execute the following:

grunt test

This will:

  • Compile ClojureScript source for the backend and frontend
  • Run the backend and frontend tests

Note: This effectively runs lein cljsbuild once twice, once for the backend and once for the frontend. This means it's slow. If you plan on running tests continuously, see using --with-tests above under Development.

About

Yeoman generator for webapps utilizing ClojureScript on the front-end and back-end.

Resources

License

Stars

Watchers

Forks

Packages

No packages published