abridge

Streaming minifier for JS and CSS

npm install abridge
6 downloads in the last day
81 downloads in the last week
237 downloads in the last month

Abridge

npm install abridge

Abridge is a streaming compiler for CSS & JavaScript. It is a superset of ycssmin and uglify-js, with a streamable interface on top.

Usage

var abridge = require('abridge');
/* abridge.{Minifier, createStream, minify} */

Piping output

Pipe #minify output to any writable stream.

abridge.minify('path/to/my/file.js').pipe(process.stdout);

You may use either a String or an instance of fs.ReadStream as a first argument.

var inputStream = require('fs').createReadStream('path/to/my/file.css');
abridge.minify(inputStream).pipe(process.stdout);

Using callback

Throw in a callback if you desire.

abridge.minify('file.js', function(err, data) {
});

minify is createStream

abridge.createStream('file.css').pipe(process.stdout);

Minify multiple files at once

abridge.minify(['file1.js', 'file2.js']).pipe(process.stdout);

Serve minified scripts and styles

Abridge can be integrated into a web server for quickly minifying scripts & styles.

var http = require('http');
var server = http.createServer(function(req, res) {
    abridge.createStream(req.url.slice(1)).pipe(res);
});
server.listen(8080);

For a complete file server solution that uses Abridge minification as well as automatic gzipping, see Lactate

License

MIT

npm loves you