-
Notifications
You must be signed in to change notification settings - Fork 32
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
[Bug]: Minifying CSS deletes blocks of code #180
Comments
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
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
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
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
Yes indeed, I'm seeing issues too since I'm not certain our issues are identical, but I suspect they come from the same source since disabling |
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
Regardless of the validity of their example, this is a real issue - or at least was when I commented. |
Can you clarify? Because I've checked and the problem is not new. |
I think that we should refactor the css logic, because there are more problems which arise when custom fragments are used: <style type="text/css">
{% ignore1 %}
a {
{% ignore2 %}
}
.a {
{% ignore2 %}
}
{% ignore3 %}
</style> <style type="text/css"> {% ignore1 %} a{} {% ignore2 %} .a{ {% ignore2 %} }</style> And with the patch from the PR: <style type="text/css"> {% ignore1 %} a{} {% ignore2 %} .a{ {% ignore2 %} } {% ignore3 %} </style> |
My original issue seems to be resolved now, so whatever broke it seems to have been fixed since then. It was definitely new around the time I posted though. I see the repro hasn't changed, so it could have been caused by yet another subdependency of this one if I had to guess. |
@rogeriopvl, @sibiraj-s is it possible to progress the PR I have attached to this bug at all? |
What happened?
When running the minifier with the following input:
And settings:
The output is:
Where it should be:
Full test program:
Version
7.2.0
What browsers are you seeing the problem on?
No response
Link to reproduce
https://stackblitz.com/edit/node-hnsagk?file=index.js
Relevant log output
No response
Willing to submit a PR?
None
The text was updated successfully, but these errors were encountered: