cakehelper

Utility library for easing the setup of a projects cake tasks.

Utility library for easing the setup of a projects cake tasks.

##Usage

npm install cakehelper
CakeHelper = require "cakehelper"
 
paths =
  "base"      : [ "./src", "./public" ]
  "styles"    : [ "./src/resources/css", "./public/resources/css" ]
  "templates" : [ "./src/resources/templates", "./public/resources/templates" ]
 
tasks = new CakeHelper { paths }
 
task "compile", "Compiles all source files", -> tasks.do "compile"

##CoffeeScript You may optionally set a path of "coffee": [ inPath, outPath ]. If not set it will default to using the base path.

###API

# Compiles all .coffee files
tasks.do "compile:coffee"
 
# Watches for and compiles all changes to .coffee files
tasks.do "watch:coffee"

##Styles

###Stylus You may optionally set a path of "styles": [ inPath, outPath ]. If not set it will default to using the base path.

####API

# Compiles all the .styl files
tasks.do "compile:stylus"
 
# Watches for and compiles all changes to .styl files
tasks.do "watch:stylus"

###Less You may optionally set a path of "styles": [ inPath, outPath ]. If not set it will default to using the base path.

####API

# Compiles all the .less files
tasks.do "compile:less"
 
# Watches for and compiles all changes to .less files
tasks.do "watch:less"

##Templates

###Dust You may optionally set a path of "templates": [ inPath, outPath ]. If not set it will default to using the base path.

####API

# Compiles all the .dust files
tasks.do "compile:dust"
 
# Watchs for and compiles all changes to .dust files
tasks.do "watch:dust"

###Jade Jade has three different types of compilation:

  1. Raw - Compiles a .jade template file into a simple javascript function for runtime use
  2. AMD - Compiles a .jade template file into an AMD module for runtime use
  3. JML - Jade Markup compiles a .jml file into an html file for runtime use

####Paths Each of these will look for a different path property before falling back to the base path.

They all use the following form:

"jade:<type>": [ inPath, outPath ]

####API Each type of compilation can use the following form of invocation as well

# Compiles all of the given types files
tasks.do "compile:jade:<form>"
 
# Watches for and compiles all changes to the given types files
tasks.do "watch:jade:<form>"

Jade also has an aggregate API:

# Effectively runs through all three types, compiling out all the files
tasks.do "compile:jade:all"
 
# Watches for and compiles all changes to all types
tasks.do "watch:jade:all"