I'm dynamically assigning a value to a $baseline
variable using SASS functions.
I have a px to REM converter
$old-ie: true;
$font-base: 16px;
@function rem($size) {
@if ($old-ie) {
@return #{$size}px;
}
@else {
$remSize: $size / $font-base;
@return #{$remSize}rem;
}
}
$baseline = rem(10);
h1 {
margin-bottom: $baseline*2;
// This shows as margin-bottom: rem(10)*2; in the stylesheet if $old-ie is set to true.
}
Could be related to interpolation but the * 1px hack doesn't seem to solve it. Any suggestions / alternatives or workarounds?