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

calc whitespace not always preserved #22

Closed
futtta opened this issue Feb 24, 2015 · 11 comments
Closed

calc whitespace not always preserved #22

futtta opened this issue Feb 24, 2015 · 11 comments

Comments

@futtta
Copy link

futtta commented Feb 24, 2015

An Autoptimize-user has CSS with a calc in it which gets broken. Whereas YUI-CSS-compressor-PHP-port normally preserves spaces, it does not in this case (confirmed using GUI)

Test input;
input { width: calc(100% - (1em*1.5)); }

Expected output:
input{width:calc(100% - (1em*1.5))}

Actual Output:
input{width:calc(100% -(1em*1.5))}

Frank

futtta added a commit to futtta/YUI-CSS-compressor-PHP-port that referenced this issue Nov 28, 2015
@futtta
Copy link
Author

futtta commented Nov 29, 2015

improved fix; futtta@5cadbf1

@rostik
Copy link

rostik commented Oct 4, 2016

seems like it fixes "- (" but not ") -"

futtta added a commit to futtta/YUI-CSS-compressor-PHP-port that referenced this issue Oct 4, 2016
@futtta
Copy link
Author

futtta commented Oct 4, 2016

can you try with this commit @rostik ?

@rostik
Copy link

rostik commented Oct 4, 2016

@futtta that didnt work, but i did this, not sure if its correct, but it worked

$this->preserved_tokens[] = preg_replace('/([+-]{1})(/','/$1 (/',trim(preg_replace('/\s_([_/(),])/', '$1', $matches[2])));

@futtta
Copy link
Author

futtta commented Oct 4, 2016

yeah, had a stupid mistake in my code (forgot re-replacing $calc by $matches[2]) cfr. this commit.

can you try again?

@rostik
Copy link

rostik commented Oct 4, 2016

this works. thanks! @futtta

@futtta
Copy link
Author

futtta commented Oct 4, 2016

great, thanks for testing & confirming! :-)

futtta added a commit to futtta/autoptimize that referenced this issue Oct 4, 2016
@sambolek
Copy link

Can this fix be implemented into the mainline please?

@tubalmartin
Copy link
Owner

Thank you for the fix. I'll release it this week ;)

@futtta
Copy link
Author

futtta commented Mar 26, 2017

great to see you're back @tubalmartin :-)

@tubalmartin
Copy link
Owner

Fixed in v2.4.8-p7 release. Thank you guys!

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

4 participants