Express minify html
var express = require('express');
var minifyHTML = require('express-minify-html');
var app = express();
app.use(minifyHTML({
override: true,
exception_url: false,
htmlMinifier: {
removeComments: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeEmptyAttributes: true,
minifyJS: true
}
}));
app.get('hello', function (req, res, next) {
res.render('helloTemplate', { hello : 'world'}, function(err, html) {
// The output is minified, huzzah!
console.log(html);
res.send(html);
})
});
Bored Bird