esmall
a simple minifier for for es+ code
How it works
Just a little wrapper around babili with a little reggae to deal with comments
Using the cli
$ npm install --global esmall
$ esmall input.js // output to stdout
$ esmall input.js -o output.min.js // output to file
$ cat path/to/file.js | esmall > this-works.min.js
Current API
Callback API
var Esmall = require('esmall');
var esmall = new Esmall({
});
esmall.minify('code', (e, min) => {
if (e) return console.error(new Error(e));
console.log(min);
});
Stream API
var fs = require('fs');
var Esmall = require('esmall');
var esmall = new Esmall({
});
fs.createReadStream('path/to/file.js')
.pipe(esmall)
.pipe(process.stdout);
This is gross
I know 🎉
TODO
License
Apache v2.0