Skip to content

Commit

Permalink
Merge pull request #82 from goofy-code/feature/remove-multi-line-comm…
Browse files Browse the repository at this point in the history
…ents

Match multiline comments with removeComments option
  • Loading branch information
jeanfredrik authored Nov 16, 2022
2 parents 42a7d88 + c23952b commit 12d5168
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/withHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export const withHTML = makeDecorator({
code = code.replace(/<!--\s*-->/g, "");
}
if (removeComments === true) {
code = code.replace(/<!--.*?-->/g, "");
code = code.replace(/<!--[\S\s]*?-->/g, "");
} else if (removeComments instanceof RegExp) {
code = code.replace(/<!--(.*?)-->/g, (match, p1) =>
code = code.replace(/<!--([\S\s]*?)-->/g, (match, p1) =>
removeComments.test(p1) ? "" : match,
);
}
Expand Down

0 comments on commit 12d5168

Please sign in to comment.