Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function(value, options, callback, errorback) {
options.log = function(message) {
console.log(message);
};
var minified;
try {
minified = minify(value, options);
}
catch (err) {
return errorback(err);
}
callback(minified);
};
})();
addEventListener('message', function(event) {
try {
var options = event.data.options;
options.log = function(message) {
console.log(message);
};
postMessage(minify(event.data.value, options));
}
catch (err) {
postMessage({
error: err + ''
});
}
});
postMessage(null);
postProcessHtml (html, assets, assetTags) {
if (typeof html !== 'string') {
return Promise.reject(new Error('Expected html to be a string but got ' + JSON.stringify(html)));
}
const htmlAfterInjection = this.options.inject
? this.injectAssetsIntoHtml(html, assets, assetTags)
: html;
const htmlAfterMinification = typeof this.options.minify === 'object'
? require('html-minifier-terser').minify(htmlAfterInjection, this.options.minify)
: htmlAfterInjection;
return Promise.resolve(htmlAfterMinification);
}
HtmlMinifierFilter.prototype.processString = function(string) {
return minify(string, this.minifierOptions);
};