Is there any way to do the following in a single line?
--widthA: get-vw(20px);
font-size: calc(5px + var(--widthA));
Since I need to set a minimum font-size. The get-vw function will calculate 20px in vw and I need to add 5px on top of that.
Yes, you can write this in one line (without variable) using interpolation (#{...}):
font-size: calc(5px + #{get-vw(20px)});
demo (with example function): https://jsfiddle.net/wccoLefp/
Sass allows any text in these function calls, including nested parentheses. Nothing is interpreted as a SassScript expression, with the exception that interpolation can be used to inject dynamic values.
Sass: Special Functions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With