Closed sasoriza closed 5 years ago
What version of Cssmin are you using? Please check and report. If you could provide a test case (broken css code) I will check it against latest 4.1 version.
I am using version 2.3.2. I noticed it is working sometimes even for px values but not always, still trying to find out what is causing the differing behavior.
Minify v2.3.2 uses Cssmin v2.4.8 branch which is quite old and has some bugs. However, minify v3.0.1 uses v4.1.0 version of Cssmin which is the latest & much more reliable. I suggest updating to the latest version of minify if you can. As for your issue, paste the CSS code that is incorrectly compressed and I may be able to give you an explanation about the output result after compression.
I will try it with the newer version, thanks.
Here are some code examples
Working:
h1{font-weight:600;color:#16BDD6;margin-bottom:25px;margin-bottom:10px;font-size:-webkit-calc(20px + 1vw);font-size:-moz-calc(20px + 1vw);font-size:calc(20px + 1vw)}
In that very same file this non-working code is present aswell:
.h1{font-weight:600;color:#16BDD6;margin-bottom:25px;font-size:-webkit-calc(20px+1vw);font-size:-moz-calc(20px+1vw);font-size:calc(20px+1vw)}
Also in that same file another working one:
.legend{margin:0;margin-bottom:10px;color:#1A1A1A;font-family:"Open Sans",Helvetica,Verdana,Arial,sans-serif;font-weight:400;font-style:normal;line-height:1.4;text-rendering:optimizeSpeed;margin-top:30px;margin-bottom:15px;padding-bottom:7px;border-bottom:1px solid #A1A1A1;font-size:-webkit-calc(13px + 1vw);font-size:-moz-calc(13px + 1vw);font-size:calc(13px + 1vw)}
And this one, incorrectly compressed:
h3,.h3{margin:0;margin-bottom:10px;color:#1A1A1A;font-family:"Open Sans",Helvetica,Verdana,Arial,sans-serif;font-weight:400;font-style:normal;line-height:1.4;text-rendering:optimizeSpeed;font-size:-webkit-calc(13px+1vw);font-size:-moz-calc(13px+1vw);font-size:calc(13px+1vw)}
Could you provide the unminified CSS code or file of that example code? Because I can't reproduce this with v4.1.0
If the first number is a value with px, the spaces within calc() will still be removed and the entire function will be ignored. This will not happen if the first number is a % value. I am using a magento extension that uses https://github.com/mrclay/minify which apparently uses this(?), so I am not exactly sure where to report this...