-
Notifications
You must be signed in to change notification settings - Fork 468
Closed
Description
Seen failing on 3.5.0.beta2, on node-sass 4.5.3 and here on Sassmeister. Seen working on Ruby Sass v3.4.21.
Mixin variable arguments with keywords misbehave when used alongside other keyword arguments.
Error message is à la "Mixin brokenTest has no parameter named $width on line 17 at column 21
"
This is independent of declaration order (see tests 1 + 2 below), notwithstanding scenarios where named arguments are passed ordinally (see test 3, which happens to work). If the only arg is a variable argument then it behaves as expected (4 + 5). This issue appears in both Sass and SCSS syntaxes.
@mixin brokenTest($color: red, $variableArguments...) {
$width: map-get(keywords($variableArguments), width);
a {
width: $width;
color: $color;
}
}
@mixin workingTest($variableArguments...) {
$width: map-get(keywords($variableArguments), width);
$color: map-get(keywords($variableArguments), color);
a {
width: $width;
color: $color;
}
}
@include brokenTest($width: 30px, $color: blue); // #1 fails
@include brokenTest($color: blue, $width: 30px); // #2 fails
@include brokenTest(blue, $width: 30px); // #3 works (!)
@include workingTest($width: 30px, $color: blue); // #4 works
@include workingTest($color: blue, $width: 30px); // #5 works
Admin Edit: Changed sample from sass to scss syntax