Update what was added in PR #184 and then updated in PR #188 for removing inline CSS and JavaScript comments:
Add support for not removing ignored comments (e.g. /*! ignored comment */).
Update single line comment handling (e.g. // comment):
Only remove single line comments when they come after a character explicitly allowed instead of any character other than what was explicitly disallowed. This will fix the edge cases where some data URIs or protocol-relative URLs were matched as a comment. This may need to be expanded upon if more characters are found where this type of comment comes after.
Do not remove single line comment if it contains a ; and did not start at the beginning of a line with or without preceding space(s) and/or tab(s). This will help prevent false matches.
Update what was added in PR #184 and then updated in PR #188 for removing inline CSS and JavaScript comments:
Add support for not removing ignored comments (e.g.
/*! ignored comment */
).Update single line comment handling (e.g.
// comment
):Only remove single line comments when they come after a character explicitly allowed instead of any character other than what was explicitly disallowed. This will fix the edge cases where some data URIs or protocol-relative URLs were matched as a comment. This may need to be expanded upon if more characters are found where this type of comment comes after.
Do not remove single line comment if it contains a
;
and did not start at the beginning of a line with or without preceding space(s) and/or tab(s). This will help prevent false matches.Regex tests:
Old pattern: https://regex101.com/r/iIt1Ng/1
New pattern: https://regex101.com/r/qSKTGx/1