autominify

Auto-minifier middleware for js files in an express-served node.js project

npm install autominify
1 downloads in the last week
12 downloads in the last month

Autominify

Node.js Express Auto-minifier middleware for javascript.

We expect you to be using connect or Express.

When Express receives a request for a javascript file, we check to see if it's already minified (ends in .min.js) and if not, then we create a serve a minified file instead.

For debugging, you can append a url variable of &autominify=false and the original files will be served instead.

Typical

var autominify = require("autominify");
//defaults to gcc (google closure compiler)
app.use(autominify(path.join(__dirname, 'public', 'js')));

Many Paths

var autominify = require("autominify");
app.use(autominify(path.join(__dirname, 'public', 'js')));
app.use(autominify(path.join(__dirname, 'public', 'javascripts')));
app.use(autominify(path.join(__dirname, 'public', 'javascript')));

Different Compiler

var autominify = require("autominify");
app.use(autominify(path.join(__dirname, 'public', 'js'), 'yui-js'));

Supported Compilers

  • no-compress
  • yui-js
  • gcc
  • uglifyjs
npm loves you