nitro
NodeJS code building library, focused on simplicicy
nitro
was developed to provide an easy build system for modern languages stack like,
sass, less, coffeescript, or custom stuff through syncronous but fast processing
Installation
npm install nitro --save-dev
Quick Example
var nitro = ;nitrodir'src';nitrodir'src';nitro;
Basics
nitro.cwd()
nitro;
nitro.exec() allows syncronous execution of shell commands
nitro;
Files and Directories Processing
nitro.file
var file = nitrofile;// returns true/false if file existsfile;// returns file contentsfile;// returns JSON parsed file contentsfile;// writes contents to filefile;// writes contents to file in JSON format indented by tabsfile;// copies through fs stream file to destinationfile;// returns a function that matches specified filter (string or array of strings)file;
nitro.dir() returns a dir object
var dirSrc = nitrodir'src';// create sub folders :: returns (boolean)dirSrc;// check if folder exists :: returns (boolean)dirSrc;// copy folder contents to destinarion :: returns (boolean)// (optional) filter: string using minimatch format (https://github.com/isaacs/minimatch)// dest: destination folderdirSrc;// removes selected directory :: returns dirSrcdirSrc;// expand contents of directory :: returns list of files that matches filter// filter: string or array of strings using minimatch format (https://github.com/isaacs/minimatch)dirSrc;// alias of nitro.watch(dirPath, handler)dirSrc;// creates an instance of class Files() with files matching the filter :: returns filesList// filter: string or array of strings using minimatch format (https://github.com/isaacs/minimatch)dirSrc;// equivalent to nitro.load(filter, { cwd: 'src' });
nitro.load(filter, options)
// creates an instance of class Files() with files matching the filter :: returns filesList// filter: string or array of strings using minimatch formatvar filesList = nitro
class Files() instance methods, applied to loaded files
var filesList = nitrodir'src';// iterate among files in listfilesList;// new loaded files (using same cwd) are appended to current listfilesList;// is equivalent to: nitro.dir('src').load('{,**/}*.{js,coffee}')// or to: nitro.dir('src').load(['{,**/}*.js', '{,**/}*.coffee'])// this applies to both js as compiled coffee to jsfilesList;// you can work with a subset of files and if a new list is returned,// files will be extracted from initial list and appended to remaining filesfilesList;// writes files in defined folderfilesList;// you can join all files into one by:filesList;// or through:filesList;
Working with Tasks
// file: make.jsvar nitro = ;nitronitro;nitro;nitro;nitro;nitro;nitro;// executing shell commandnitro;
main options from shell
node make devnode make livenode make build
Tests
make test