0

I'm building a mixin in Sass 3.4.5, but its not behaving as I would expect, for example:

@mixin test($values...) {
  $items: length($values); // length is 2

  @if $items > 1 {
    $var: true;
    @debug $var; // output is 'true'
  }

  $var: false !default;

  @debug $var; // output is 'false', but it should be 'true'
}

@include test(16, 24);

For some reason $var gets overridden by !default, which should not happen. However, this problem does not happen when I remove the @if directive.

Any ideas?

Jrn
  • 1,185
  • 1
  • 13
  • 27
  • possible duplicate of [SCSS change variable out of scope from inside @if](http://stackoverflow.com/questions/16742238/scss-change-variable-out-of-scope-from-inside-if) – cimmanon Oct 24 '14 at 17:38
  • Also related: http://stackoverflow.com/questions/25300453/does-sass-support-inline-if-statements – cimmanon Oct 24 '14 at 17:39
  • @cimmanon Thanks for the links, I was able to find a workaround, and sorry for the duplicate. I did search before posting, but guess not hard enough. Voted to be closed. – Jrn Oct 24 '14 at 18:33

0 Answers0