philhawksworth / netlify-plugin-minify-html

26 stars 8 forks source link

Can't get ignoreCustomFragments working for <div id="search-results">whatever<div> #17

Open Robin-Wils opened 3 years ago

Robin-Wils commented 3 years ago

I managed to make a JavaScript regex which finds the div which I want to exclude from the minifier, but the minifier crashes. Regex: ignoreCustomFragments = [ '/<div\s+id="search-results">[\S\s]*?<\/div>/gm' ]

The div has to be excluded from the minifier. It is the only element which breaks when I run the minifier with my custom settings. Any tips? I don't see what I am doing wrong here. The regex works fine on https://regex101.com .

Robin-Wils commented 3 years ago

I solved it with html ignore comments for now. I will leave the issue open, for other users who have the same problem.