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 filestasks.do "compile:coffee" # Watches for and compiles all changes to .coffee filestasks.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 filestasks.do "compile:stylus" # Watches for and compiles all changes to .styl filestasks.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 filestasks.do "compile:less" # Watches for and compiles all changes to .less filestasks.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 filestasks.do "compile:dust" # Watchs for and compiles all changes to .dust filestasks.do "watch:dust"
Jade
Jade has three different types of compilation:
- Raw - Compiles a .jade template file into a simple javascript function for runtime use
- AMD - Compiles a .jade template file into an AMD module for runtime use
- 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 filestasks.do "compile:jade:<form>" # Watches for and compiles all changes to the given types filestasks.do "watch:jade:<form>"
Jade also has an aggregate API:
# Effectively runs through all three types, compiling out all the filestasks.do "compile:jade:all" # Watches for and compiles all changes to all typestasks.do "watch:jade:all"