-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
fix: Output correct css when using css function in max(). #3708
base: master
Are you sure you want to change the base?
Conversation
Thanks for contribution. |
That doesn't seem correct. |
In less.js/packages/less/src/less/functions/color.js Lines 40 to 51 in 1eafc06
So, we also throw an exception on non-Dimension value. Since the node was not successfully converted, Less will be output as is |
@lumburr That's true but this will output as-is if compiled in Less. .rule {
color: rgb(0 128 var(--num));
} So I'm saying, this in Less: .rule {
value: max(1, calc(1 + 1));
} ...should output: .rule {
value: max(1, calc(1 + 1));
} |
Ohh,@matthew-dean I may not have expressed it clearly. .rule {
value: max(1, calc(1 + 1));
} should output .rule {
value: max(1, calc(1 + 1));
} And now the issue is caused because: max(1, calc(1 + 1)) is treated as max(1) So what this PR does is to make Less output
correctly again. |
Oops, can you resolve conflicts? |
Hi @lumburr, thanks for your contribution. Is there a chance you'll be able to fix merge conflicts here so that this PR can be merged? |
@iChenLei Would you have time to resolve conflicts and add test cases for this issue to see if they are resolved? |
@matthew-dean |
What: fix #3604
Why:
How:
For the following ast node
less will skip non-Dimension nodes
https://github.com/less/less.js/blob/master/packages/less/src/less/functions/number.js#L26-L31
So, max(1, calc(1 + 1)) is treated as max(1).
We should not skip these nodes.
Checklist: