express-minify-html
express-minify-html copied to clipboard
Must be to Error handler
In my scenario if html-minify has error then whole server is down! I think, that html-minify must be in try{...}catch(err){...} to prevent server down, and if err then return original html;
this code: ` var sendMinified = function (callback) {
// No callback specified, just minify and send to client.
if (typeof callback === 'undefined') {
return function (err, html) {
if (err) {
return next(err);
}
html = minify(html, opts.htmlMinifier);<<<<<<<-------------- what if error occur???
res.send(html);
}
} else {
// Custom callback specified by user, use that one
return function (err, html) {
if (html) {
html = minify(html, opts.htmlMinifier);<<<<<<<--------------- what if error occur???
}
callback(err, html);
}
}
};`
This is fixed by #11