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

Incorrect minified CSS output #267

Closed
wearymax opened this issue Dec 11, 2018 · 2 comments
Closed

Incorrect minified CSS output #267

wearymax opened this issue Dec 11, 2018 · 2 comments

Comments

@wearymax
Copy link

wearymax commented Dec 11, 2018

Hi there!

I see that version 1.3.61 compiled incorrect CSS output from calc(var() + var()) methods, an example this code:
ul p { padding-left: calc((var(--icon-size) / 2) + var(--horisontal-space)); }

will look as:
ul p{padding-left:calc((var(--icon-size) / 2)+var(--horisontal-space))}

that is invalid because math operations and variables must be separated with space symbol. This is valid output:
ul p{padding-left:calc((var(--icon-size) / 2) + var(--horisontal-space))}

In the 1.3.60 it's works fine, check please!

@matthiasmullie
Copy link
Owner

Hey @wearymax - thanks for the report!

I added your example code to the test suite, but I am not able to reproduce the issue - both on my own machine, or on Travis CI.
It minifies just fine for me, and leaves the calc intact.

Try increasing pcre.backtrack_limit & pcre.recursion_limit (http://php.net/manual/en/pcre.configuration.php)?
If they're too low & the minify file too complex, that could cause the processing to fail (and it's possible that it already failed before, but the effects didn't show up then...)

If the problem persists, feel free to reopen this ticket with some additional details (complete CSS, PHP version, pcre config, ...)

@TomCorvus
Copy link

TomCorvus commented Dec 18, 2018

Hi @matthiasmullie,

I have a similar issue when I try to minify core.js file of AmMap 4.
https://www.amcharts.com/lib/4/core.js?ver=1.2

We are using WP Rocket, a WordPress cache plugin. It uses your minify system.

When this file is minified, a semicolon is deleted which cause a JS error:
Uncaught SyntaxError: Unexpected token }

I opened an issue on AmCharts4 repo:
amcharts/amcharts4#585

I also tested with your online minifier, and the problem is present.

Here is the code when the file is minified and merged:
t.length,o=0;o<r&&(t[o](n),i);++o)}}

And the code of the original file:
t.length,o=0;o<r&&(t[o](n),i);++o);}}

I don't if this error is the same of @wearymax and his CSS syntax but it looks like.

Below some information of our server:
PCRE Library Version: 8.41 2017-07-05
pcre.backtrack_limit: 1000000
pcre.jit: 1
pcre.recursion_limit: 100000
PHP Version: 7.2.12
Minify Version used by WP Rocket: 1.3.60

Thanks.

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

No branches or pull requests

3 participants