I have a function which converts px to rem. For example:
height: rem-calc(14px); // makes height: 1rem;
Now I would like to calculate with it from variables. For example:
$switch-track-width: rem-calc(50px);
$switch-thumb-size: $switch-track-width / 2; // making it 25px or 1.7857rem in this case
That doesn't work so I tried something else:
$switch-thumb-size: ($switch-track-width / 2) + 0rem;
$switch-thumb-size: (#{$switch-track-width} / 2) + 0rem;
Both $switch-thumb-size examples aren't working either. Now this is dividing but I'm also unable to get times (*), plus (+) and minus (-) working.
I'm also having a problem when calculating with 2 variables. For example:
$switch-track-height: rem-calc(14px);
$switch-track-width: rem-calc(50px);
$switch-thumb-right: $switch-track-height - $switch-track-width;
I prever to keep the function inside the variable instead of in the property like: height: rem-calc($switch-track-height);.
If someone could tell me how to calculate with SCSS variables on both examples that would be very helpful.
Thanks in advance