CrushIt is a commandline tool for crawling web pages and compiling scripts
npm install crushit
npm install -g crushit
`
Usage
`
Basic usage
crushit [options] [url] [file]
Beautify output code
crushit -b [url]
Include comments in the output code
crushit -c [url]
Perform maximum optimisation
crushit -x [url] [output filename]
Beautify output code and include comments
crushit -bc [url]
`
CLI Examples
`
Compiling scripts from my website with default options
crushit http://www.ragingflame.co.za
Compiling scripts from my website with options and specifying an output file
crushit -xm http://www.ragingflame.co.za crushed.js
`
You can also include CrushIt in your node programs
`
var crushIt = require("crushit");
crushIt = new crushIt();
crushIt.squeeze(options, callback);
options
website - (String) Web page URL
comments - (Boolean) Keep comments
beatify - (Boolean) Beautify output code
mangle - (Boolean) Mangle variable names
max - (Boolean) Perform maximum optimisation
callback - (Function) Callback function that takes 2 arguments, the first one is an error flag or object and the second one is the output code
`
Program Example
`
var crushIt = require("crushit");
crushIt = new crushIt();
crushIt.squeeze({
website: "http://www.ragingflame.co.za",
comments: false,
beatify: false,
mangle: true,
max: true
},
function (error, code) {
if (error) {
console.error(error);
}
else {
console.log(code);
}
});
`
Short Code
The options argument may also be a string variable
`
var crushIt = require("crushit");
crushIt = new crushIt();
crushIt.squeeze("http://www.ragingflame.co.za", function (error, code) {
if (error) {
console.error(error);
}
else {
console.log(code);
}
});
`
Testing
`
npm test
``