Quick boilerplate for Coffeescript app, backed by Express, Jade and Stylus
JavaScript CoffeeScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
lib
public
src
test
views
.gitignore
Cakefile
app.js
package.json
readme.md

readme.md

Cham

Quick boilerplate for setting up a basic Coffeescript driven app, with Stylus and Jade for the frontend.

How to use

  • Clone this repo
  • Copy all files to your new project
  • Check out the docs for each file at the /docs folder
  • Start hacking!

The Stack

File Structure

  • app.js: Main app file, run node app.js to start app
  • public/: Public folder, all front-end files go here
    • css
    • images
    • js
  • lib/: All backend files go here
  • test/: Where all tests are. Currently uses Vows as example
  • views/: Where all Jade templates are
  • src/: Source files, where all Coffeescript and Stylus file resides. The file structure within src/ folder mirrors the root folder, saves time trying to hunt for files
  • docs/: Docco generated documentation files

Compiling Files

There are a couple of helper functions defined within the Cakefile, which are:

cake watch                # Watches all Coffeescript(JS) and Stylus(CSS) files
cake watchJS              # Watches all coffeescript files for changes
cake watchCSS             # Watches all CSS files for changes
cake compileJS            # Compiles all Coffeescript files into JS
cake test                 # Runs all tests
cake docs                 # Create documentation using Docco

To run Cakefile remember to install coffee-script as a global module,

npm install coffee-script -g

To compile the CSS you need to install stylus as a global module too in order to run the executable:

npm install stylus -g

Then, at the root folder, just do

cake watch

And magic happens! :)

The idea behind

I love Coffeescript. No doubt to that. So everytime I start a new project I find myself doing all the same steps over and over, creating folders, copying files, installing modules, setting up Cakefile tasks and all those trivial tasks.

So I thought, why not create a template that I can use over? And then I thought, why not share it with everyone?

Cham is not meant to be a definitive guide to the universe of Express or Node.JS. It is a combination of ideas, regarding my personal approach of developing with Express and Coffeescript.

Cham is for...

  • CoffeeScript, Express, Jade and Stylus enthusiasts
  • Developers that wanted a quick base to start working with
  • Node.js beginners that want to learn more about Node.js with a more approachable example

Last words

Fellow developers, please do share with me what are your thoughts, I would love to hear from you and see how we can do better!

Trivia: "Cham" is also a Malaysian/Singaporean drink that mixes coffee, hot chocolate, tea, sugar, milk and a bunch of other stuff. It's awesome. :3