Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple ignored CSS blocks #181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrisstaite-menlo
Copy link

If there are multiple ignored CSS blocks within a single clean-css warning message, only the first is replaced with the ignore code. This means that some ingored blocks are simply deleted from the output.

The problem is simply that the RegExp is only applied once, despite having the global flag set on it. This is fixed by calling exec on the RegExp until it yields no further matches.

Added a test for this error case.

Fixes #180

@chrisstaite-menlo chrisstaite-menlo force-pushed the bugfix/multiple-css-warnings branch 3 times, most recently from dfa0247 to 1d71bd0 Compare August 21, 2024 12:42
If there are multiple ignored CSS blocks within a single clean-css
warning message, only the first is replaced with the ignore code.
This means that some ingored blocks are simply deleted from the output.

The problem is simply that the RegExp is only applied once, despite
having the global flag set on it.  This is fixed by calling `exec` on
the RegExp until it yields no further matches.

Added a test for this error case.

Fixes terser#180
@chrisstaite-menlo chrisstaite-menlo force-pushed the bugfix/multiple-css-warnings branch from 1d71bd0 to 122190e Compare August 27, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Minifying CSS deletes blocks of code
1 participant