UNPKG

html-minifier-loader

Version:

Webpack loader that minifies HTML by [html-minifier](https://github.com/kangax/html-minifier)

19 lines (17 loc) 530 B
var minify = require('html-minifier').minify , loaderUtils = require('loader-utils') module.exports = function(source) { this.cacheable && this.cacheable() var defaultOptions = { removeComments: true, collapseWhitespace: true } , options = this.options && this.options['html-minifier-loader'] || {} , options2 try { options2 = loaderUtils.getOptions(this) } catch(e) { options2 = {} } return minify(source, Object.assign(defaultOptions, options, options2)) }