-
Notifications
You must be signed in to change notification settings - Fork 12k
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 calc() breaks when using 3+ variable fallbacks on Ivy/Angular 9 #16910
Comments
Found a workaround: Put the operands of the calculation into their own variables before using calc() Instead of .some-rule-lg {
--width-lg: 1px;
--width-md: 2px;
--width-sm: 3px;
--offset-lg: 4px;
--offset-md: 5px;
--offset-sm: 6px;
width: calc(var(--width-lg, var(--width-md, var(--width-sm, 0))) + var(--offset-lg, var(--offset-md, var(--offset-sm, 0))));
} do this .some-rule-lg {
--width-lg: 1px;
--width-md: 2px;
--width-sm: 3px;
--offset-lg: 4px;
--offset-md: 5px;
--offset-sm: 6px;
--temp-calc1: var(--width-lg, var(--width-md, var(--width-sm, 0)));
--temp-calc2: var(--offset-lg, var(--offset-md, var(--offset-sm, 0)));
width: calc(var(--temp-calc1) + var(--temp-calc2));
} |
Looks like a in the CSS optimizer we use (CSSNano). I'm able to reproduce it on their playground (error is in the JavaScript console). Filed an issue for them to look at: cssnano/cssnano#880. Once it gets fixed there, Angular should receive the fix in our natural rollout process. There's nothing for us to do here, just in a holding pattern until it gets addressed upstream. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command
Is this a regression?
Yes, the previous version in which this bug was not present was: 8.2.3
Description
var(--x, var(--y, var(--z, 0)))
breaks inside of the calc-function.Whereas
var(--x, var(--y, 0))
still seems to work.🔬 Minimal Reproduction
ng build --aot --prod
🔥 Exception or Error
🌍 Your Environment
Anything else relevant?
We're using SCSS for our stylesheets.
The text was updated successfully, but these errors were encountered: