ignoreCustomComments failed
hduchesn opened this issue · 4 comments
Hi,
when using your middle-ware with the option ignoreCustomComments
for htmlMinifier the plugin failed
I did some test and the result is here:
the opts I received line 7 is correct
opts.htmlMinifier (1) : { removeComments: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeEmptyAttributes: true,
minifyJS: true,
ignoreCustomComments: [ /^\s+ko/, /\/ko\s+$/ ] }
but after the merge line 23, I get this
opts.htmlMinifier (2) : { removeComments: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeEmptyAttributes: true,
minifyJS: true,
ignoreCustomComments: [ {}, {} ] }
Object-merge doesn't do the job here!
And of course html-minifier failed to test the regex and crash node.js.
I think it is the same for all options using regex in html-minifier
if I comment the object-merge line and keep my option, it works well... I think there is something to fix here
Hi rv,
Thanks for the issue! Yeah, seems to be an issue with RegExp and the object-merge package. See this issue: matthewkastor/object-merge#7
Looks like there's a PR to fix it, but the author hasn't paid much attention to it...
matthewkastor/object-merge#8
I'll look for a package with similiar functionality to get this sorted out!
I swapped out the package and pushed 0.11.0. Seems to be working now. @hduchesn can you confirm?
I removed and install again express-minify-html, checked it was version 0.11 which is using lodash.merge and the package works as expected, no crash and my comment are skipped!
Thanks!