html-minifier icon indicating copy to clipboard operation
html-minifier copied to clipboard

reCustomIgnore RegExp problem

Open lls94 opened this issue 6 years ago • 1 comments

template:
<div id={{test}} class='{{test2}}' name="1994"></div>

html-minifier option:

 ignoreCustomFragments: [
                            /<%(#?)((?:==|=#|[=-])?)[ \t]*([\w\W]*?)[ \t]*(-?)%>/,
                            /{{([@#]?)[ \t]*(\/?)([\w\W]*?)[ \t]*}}/,
                            /\bsrc="([^"]*)"/
                        ]

render: <div id="123 " class="" name="1994"></div>

problem: There's an extra space

htmlminifier.js code var reCustomIgnore = new RegExp('\\s*(?:' + customFragments.join('|') + ')+\\s*', 'g');

lls94 avatar Jul 03 '19 14:07 lls94

Can’t verify right now but this should work in HTML Minifier Next. Will try to review this by myself, but would also be curious to learn more if you or anyone gets to this earlier.

j9t avatar Nov 26 '25 15:11 j9t