express minify html

Solutions on MaxInterview for express minify html by the best coders in the world

showing results for - "express minify html"
Mattia
08 Nov 2019
1 var express    = require('express');
2var minifyHTML = require('express-minify-html');
3var app = express();
4app.use(minifyHTML({
5  override:      true,
6  exception_urlfalse,
7  htmlMinifier: {
8    removeComments:            true,
9    collapseWhitespace:        true,
10    collapseBooleanAttributestrue,
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});