Robol is a simple tool for building projects, created as a Node.js module.
It allows to compile, concatenate, lint and minify JavaScript, CoffeeScript, CSS and LESS files, as well as copy and remove files and directories within the project.
Module confirmed working on MacOS X 10.8 and Windows 8.
Instalation
Install using npm with 'global' flag:
npm install robol -g
Or clone this project from github:
git clone https://github.com/filmic/Robol.git
and from the checked out repository folder run command in console:
npm install . -g
Usage
From the root of your project run command in console:
robol
Options
-c, --config Path to the config file. [default: "./robol.config.json"]
-w, --watch Enables watch mode. Changes to the source files trigger automatically build.
-v, --version Displays version of the module.
-h, --help Displays help message.
Robol requires a config file with JSON data defining inputs and outputs of the building process. By default it looks for the robol.config.json file but it can be overwritten by using -coption.
Wild cards in the filename, eg. *.js. are accepted.
Directories are copied / removed recursively.
In the watch mode any changes to the input files trigger tasks that are defined for them (building scripts, styles or copying).
For more information about UglifyJS options that can be defined in the config file ("scripts.minify_config"), see the UglifyJS 1.x documentation.
The styles can be minified and compressed (YUICompress) by setting flags "styles.minify" and "styles.minify_config.yuicompress" to true.
Examples of the JSON config file:
{
"scripts":{
"input_dir":"src/js",
"input_files":[
"test.coffee",
"helloworld.js"
],
"output_dir":"deploy/scripts",
"output_file":"scripts.min.js",
"minify":true,
"minify_config":{
"strict_semicolons":false,
"mangle":false,
"toplevel":false,
"except":[],
"defines":{},
"squeeze":false,
"make_seqs":true,
"dead_code":true
},
"lint":true,
"lint_config":{}
},
"styles":{
"input_dir":"src/css",
"input_files":[
"test.less",
"test2.css"
],
"output_dir":"deploy/styles",
"output_file":"styles.min.css",
"minify":true,
"minify_config":{
"yuicompress":true
},
"lint":true,
"lint_config":{}
},
"copy_files":{
"input_dir":"source",
"input_files":[
"*.html",
"*.shtml"
],
"output_dir":"deploy"
},
"copy_dir":{
"input_dir":"source/assets",
"output_dir":"deploy/assets"
},
"remove_files":{
"input_dir":"deploy/temp",
"input_files":[
"*.html",
"*.shtml"
]
},
"remove_dir":{
"input_dir":"deploy/assets/images"
},
"copy_file":{
"input_file":"src/js/aaa.js",
"output_file":"deploy/js/bbb.js"
}
}
The scripts JSLint options object (lint_config) can be used to overwrite the default values which are set to: