1 var express = require('express');
2var minifyHTML = require('express-minify-html');
3var app = express();
4app.use(minifyHTML({
5 override: true,
6 exception_url: false,
7 htmlMinifier: {
8 removeComments: true,
9 collapseWhitespace: true,
10 collapseBooleanAttributes: true,
11 removeAttributeQuotes: true,
12 removeEmptyAttributes: true,
13 minifyJS: true
14 }
15}));
16app.get('hello', function (req, res, next) {
17 res.render('helloTemplate', { hello : 'world'}, function(err, html) {
18 // The output is minified, huzzah!
19 console.log(html);
20 res.send(html);
21 })
22});