phpsass icon indicating copy to clipboard operation
phpsass copied to clipboard

@each malfunctions

Open wellagain opened this issue 12 years ago • 1 comments

In Ruby, this code:

$default-prefixes: webkit moz ms o;
@mixin prefixize($property, $value, $prefixes: $default-prefixes) {
    @each $prefix in $prefixes {
        -#{$prefix}-#{$property}: #{$value};
    }
    #{$property}: #{$value};
}
li {
    @include prefixize(box-sizing, border-box, moz webkit)
}
a {
 @include prefixize(box-sizing, border-box)
}

compiles into:

li {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box; 
}
a {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  -ms-box-sizing: border-box;
  -o-box-sizing: border-box;
  box-sizing: border-box; 
}

In phpsass, this very same code seems to miss the @each part and compiles into:

li {
  -moz webkit-box-sizing: border-box;
  box-sizing: border-box;
}
a {
  -webkit moz ms o-box-sizing: border-box;
  box-sizing: border-box;
}

wellagain avatar Mar 22 '13 14:03 wellagain

This is a bug in how lists are parsed; the argument $prefixes is never seen as a "list", just as a string.

Not entirely sure how to force it to treat it as a list either ...

richthegeek avatar Mar 22 '13 14:03 richthegeek