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

nth() doesn't handle maps #643

Closed
xzyfer opened this issue Nov 13, 2014 · 1 comment · Fixed by #647
Closed

nth() doesn't handle maps #643

xzyfer opened this issue Nov 13, 2014 · 1 comment · Fixed by #647

Comments

@xzyfer
Copy link
Contributor

xzyfer commented Nov 13, 2014

This can return the nth pair in a map as well. - http://sass-lang.com/documentation/Sass/Script/Functions.html#nth-instance_method

$map: (foo: bar, bar: baz);

foo {
  a: nth($map, 2);
}

Expected output

foo {
  a: bar baz;
}

Actual output

stdin:4: index out of bounds for `nth($list, $n)`
@esr360
Copy link

esr360 commented Dec 31, 2017

I still seem to be getting this issue, or at least an issue very similar to this, when using Libsass (I don't get the error when using Ruby Sass):

>> Error: index out of bounds for `nth($list, $n)`
>>         on line 21 of ../../Synergy/src/scss/mixins/_component.scss
>> >>     $namespace: nth(module-tree(&), length(module-tree(&)));

For reference here is the culpable line of code: https://github.com/esr360/Synergy/blob/4715c9ceec3ca1ad664ef0b7a093743b9929e3de/src/scss/mixins/_component.scss#L21

It should be noted that if I change this line:

$namespace: nth(module-tree(&), length(module-tree(&)));

Into this:

$this: module-tree(&);

$namespace: nth($this, length($this));

then it compiles without an error.

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

Successfully merging a pull request may close this issue.

2 participants