diff --git a/src/htmlminifier.js b/src/htmlminifier.js index 6c2d6dd..cb54ebb 100644 --- a/src/htmlminifier.js +++ b/src/htmlminifier.js @@ -905,8 +905,8 @@ async function minifyHTML(value, options, partialMarkup) { const ids = []; new CleanCSS().minify(wrapCSS(text, type)).warnings.forEach(function (warning) { - const match = uidPattern.exec(warning); - if (match) { + let match; + while ((match = uidPattern.exec(warning))) { const id = uidAttr + match[2] + uidAttr; text = text.replace(id, ignoreCSS(id)); ids.push(id); diff --git a/tests/minifier.spec.js b/tests/minifier.spec.js index 67b61a6..2fa6463 100644 --- a/tests/minifier.spec.js +++ b/tests/minifier.spec.js @@ -3594,3 +3594,14 @@ test('minify Content-Security-Policy', async () => { input = ''; expect(await minify(input)).toBe(input); }); + +test('minify CSS multiple ignore in single warning', async () => { + const input = ''; + const output = ''; + expect(await minify(input, { + ignoreCustomFragments: [/\{%[\s\S]*?%\}/], + minifyCSS: { + level: 0 + } + })).toBe(output); +});