0

I am looking at the mixin documentation and have created a simple mixin

@mixin mobile-pos($property, $offset) {
    // Fallback
    #{$property}: calc(100vh - $offset);

    // Better - for browsers that support custom css vars
    #{$property}: calc(var(--rvh) * 100 - $offset);
}

Here is how I'm using the mixin

#container-circles {
    bottom: unset;
    @include mobile-pos(top, 90px);
}

I checked the compiled CSS output

#container-circles {
  bottom: unset;
  top: calc(100vh - $offset);
  top: calc(var(--rvh) * 100 - $offset); }

Any idea why the second param is not getting compiled properly? I'm using node-sass 4.11.0

quickshiftin
  • 60,711
  • 9
  • 63
  • 83

1 Answers1

0

Using $variables inside your calc() is like this

SCSS

    @mixin mobile-pos($property, $offset) {
      // Fallback
      #{$property}: calc(100vh - #{$offset});

      // Better - for browsers that support custom css vars
      #{$property}: calc(var(--rvh) * 100 - #{$offset});
    }
Ganesa Vijayakumar
  • 2,216
  • 5
  • 23
  • 40