You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
928 B
37 lines
928 B
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
|
|
var _htmlMinifierTerser = require("html-minifier-terser");
|
|
|
|
var _default = options => function process(html, result) {
|
|
const minimizeOptions = typeof options.minimize === 'boolean' || typeof options.minimize === 'undefined' ? {
|
|
collapseWhitespace: true,
|
|
conservativeCollapse: true,
|
|
keepClosingSlash: true,
|
|
minifyCSS: true,
|
|
minifyJS: true,
|
|
removeAttributeQuotes: true,
|
|
removeComments: true,
|
|
removeScriptTypeAttributes: true,
|
|
removeStyleLinkTypeAttributes: true,
|
|
useShortDoctype: true
|
|
} : options.minimize;
|
|
|
|
try {
|
|
// eslint-disable-next-line no-param-reassign
|
|
html = (0, _htmlMinifierTerser.minify)(html, minimizeOptions);
|
|
} catch (error) {
|
|
result.messages.push({
|
|
type: 'error',
|
|
value: error
|
|
});
|
|
}
|
|
|
|
return html;
|
|
};
|
|
|
|
exports.default = _default; |