Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
  })
}); 
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #express #minify #html
ADD COMMENT
Topic
Name
3+7 =