0.1.4 • Published 11 years ago
jcompressor v0.1.4
jcompressor
jcompressor is a Closure Compliler-based JavaScript compressor (node package) that compresses all .js files in the current directory (JRE, Node.js and npm is required).
Usage
Install jcompressor
npm install -g jcompressor
Compress
- Direct to the project folder where you would like to compress
Drop into the Node REPL by executing
node
Executing the line below with optimal parameters for
.compress()
function (see #API)require('jcompressor').compress();
Check it out :)
API
compress()
takes three optional parameters in order:
- prefix: String, the prefix string added to the compressed file.
''
(empty string) by default; - suffix: String, the suffix string added to the compressed file.
'-min'
by default; - replaceOriginal: Boolean, the original files are deleted if true.
true
by default;
Take /PATH/TO/example.js as an example:
require('jcompressor').compress();
// /PATH/TO/example-min.js
require('jcompressor').compress('cc-', null, false);
// /PATH/TO/cc-example-min.js, /PATH/TO/example.js (Still survives!)
require('jcompressor').compress('', '_v1');
// /PATH/TO/example_v1.js