Simple wrapper to use html-minifier with gobble.
First, you need to have gobble installed - see the gobble readme for details. Then,
npm install --save-dev gobble-html-minifier
gobblefile.js
var gobble = require('gobble');
module.exports = gobble('src').transform('html-minifier', options);
The options
argument, if specified, is passed to html-minifier
. Please refer to the original documentation.
There is one extra option preset
in this plugin to try to make developer's life easier.
Type: string|undefined
The preset
option accepts one of three string value: "minimal"
, "safe"
, and "all"
. They correspond to the presets found on html-minifier's Github page. If left undefined or when set to unsupported value, it doesn't affect other options at all. Otherwise, the preset options act as the default and other options passed in overrides the preset.
// to use the "minimal" preset alone
gobble('src').transform('html-minifier', { preset: 'minimal' });
// use the "minimal" preset but turn off "removeComments"
gobble('src').transform('html-minifier', {
preset: 'minimal',
removeComments: false,
});