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

CSS minification breaks calc(), vendor update required #86

Closed
jbma opened this issue Jul 6, 2016 · 18 comments
Closed

CSS minification breaks calc(), vendor update required #86

jbma opened this issue Jul 6, 2016 · 18 comments
Assignees
Labels
type: bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@jbma
Copy link
Contributor

jbma commented Jul 6, 2016

When CSS minification is enabled, calc() values will be minified as well, but need to be separated by spaces.
Current behavior: calc(1.5rem+2.5px)
Expected behavior: calc(1.5rem + 2.5px)

Reported by customer: https://secure.helpscout.net/conversation/210133386/16324/?folderId=714999
Original bug in lib fixed in February: mrclay/minify#503

@jbma jbma added type: bug Indicates an unexpected problem or unintended behavior major labels Jul 6, 2016
@jbma
Copy link
Contributor Author

jbma commented Jul 6, 2016

Not sure whether I got it right in Slack: Is the library I referenced not the one we use? If it is not, the behavior (spaces being stripped) is still existent in WP Rocket, so I guess we still should do something about it.

@jbma
Copy link
Contributor Author

jbma commented Jul 6, 2016

Yes it's the right library (in the link above). We didn't update it since a long time, so we'll probably do it in the 2.9

@jbma
Copy link
Contributor Author

jbma commented Jul 6, 2016

Awesome, yes, let’s do that in 2.9. calc() isn’t the most critical CSS operation out there, but for people who do use it, the outdated behavior of our lib must be a real PITA. Will let the customer know we’ll most likely update it in 2.9.

@remyperona remyperona modified the milestone: 2.9 Sep 23, 2016
@remyperona remyperona modified the milestone: 2.9 Nov 8, 2016
@remyperona remyperona self-assigned this Nov 8, 2016
@glueckpress
Copy link
Contributor

✅ Spaces inside of calc() expressions are being preserved as expected with the current 2.9 branch. This goes for CSS files as well as for inline CSS.

Unrelated to the calc() issue, but maybe be worth noting because possibly (?) related to a vendor update: CSS files are not 100% minified, I see a lot of hard line-breaks being preserved, or new ones added. A properly minified file would usually be expected to contain only 1 long line of CSS.

@eugenem
Copy link

eugenem commented May 18, 2017

Hi! Some of calc() are still broken at 2.9.11
If you try to minify this file, for example: https://timetostepitup.com/wp-content/themes/aton-child/style.css

@remyperona
Copy link
Contributor

The remaining issues should be fixed in 2.10

@eugenem
Copy link

eugenem commented May 18, 2017

Thanks!

@GeekPress GeekPress modified the milestones: 2.10, 2.9 May 18, 2017
@shivampaw
Copy link

This still seems to exist in 2.10

@der-krueger
Copy link

Same here in 2.10.3

@remyperona
Copy link
Contributor

If you still have the issue, disable, save settings & re-enable CSS minification. It should work after.

@shivampaw
Copy link

@Tabrisrp not working.
https://www.shivampaw.com/ is the site. Scroll to bottom where the contact form is. The budget dropdown CSS isn't working - spaces in the calc function aren't there.

@remyperona
Copy link
Contributor

open a support ticket in that case, we'll look into it.

@JiveDig
Copy link

JiveDig commented Aug 25, 2017

2.10.4 - We're still experiencing this issue.

@adamlaki
Copy link

2.10.12 - Unfortunately still an issue.

@glueckpress
Copy link
Contributor

glueckpress commented Dec 11, 2017

Can’t reproduce with 2.10.12, calc() is handled correctly:

screen shot 2017-12-11 at 09 39 31

Same in 2.11 (current development branch), spaces are preserved:

screen shot 2017-12-11 at 09 41 21

@adamlaki, @JiveDig Please open a support ticket if your issue can be reproduced. Thanks!

@CobbleWebDevUser
Copy link

HI there.
I reproduce on my side.

padding-top: calc(150px + 10vw);

becomes

padding-top:calc(150px+10vw);

But it occurs only with the "+" sign.

I found a work around which work for me by wrapping the code with a

@media all {
}

When the calc() is into a media query, the spaces around "+" sign are not removed.

@mkstix6
Copy link

mkstix6 commented Mar 26, 2019

WP-Rocket Version 3.2.6

Same here I think:

Original…

height: calc(3.25rem + 2px);

…is minified to…

height: calc(3.25rem+2px);

…without the spaces it breaks.

@zumek
Copy link

zumek commented Sep 11, 2020

Issue still present in v 3.4.0.5

Is the plugin using yuicompressor? - yui/yuicompressor#59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests