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 Compressor: Issue compressing complex calcs #75

Closed
melloware opened this issue Jun 24, 2022 · 3 comments
Closed

CSS Compressor: Issue compressing complex calcs #75

melloware opened this issue Jun 24, 2022 · 3 comments
Assignees
Labels
Milestone

Comments

@melloware
Copy link
Member

original Issue: yui/yuicompressor#330

Raw:

right: calc(((100% - 1200px) / 2) + 16px);

Incorrectly compressed to:

right: calc(((100% - 1200px) / 2)+16px);

No space in the +16px

@melloware melloware added the bug label Jun 24, 2022
@melloware melloware self-assigned this Jun 24, 2022
@melloware melloware modified the milestone: 2.5.0 Jun 24, 2022
@melloware
Copy link
Member Author

melloware commented Jun 25, 2022

OK because java REGEX doesn't support balancing groups or recursion this is almost impossible to do with the current REGEXES. It would need to use real parsing to find matching parens.

https://stackoverflow.com/a/35271017/502366

Here is a Regex 101. showing the current issue: https://regex101.com/r/N2rr2m/1

@jepsar
Copy link
Member

jepsar commented Jun 25, 2022

Not bulletproof, but what about calc\([^;]+; (untested.. I'm on my phone)

@melloware
Copy link
Member Author

OK this one seems to work after testing yours calc\([^;]*\) and tweaking! All unit tests passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants