Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyword Variable Arguments fail if non-ordinal arguments exist #2394

Closed
bbbrrriiiaaannn opened this issue May 21, 2017 · 0 comments
Closed

Comments

@bbbrrriiiaaannn
Copy link

bbbrrriiiaaannn commented May 21, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants