compass-mixins
compass-mixins copied to clipboard
Possible typo leading to error
I'm getting:
{ [Error: bower_components/compass-mixins/lib/compass/functions/_lists.scss
34:12 index out of bounds for `nth($list, $n)`]
message: 'bower_components/compass-mixins/lib/compass/functions/_lists.scss\n 34:12 index out of bounds for `nth($list, $n)`',
column: 12,
line: 34,
file: './bower_components/compass-mixins/lib/compass/functions/_lists.scss',
status: 1,
messageFormatted: '\u001b[4mbower_components/compass-mixins/lib/compass/functions/_lists.scss\u001b[24m\n\u001b[90m 34:12\u001b[39m index out of bounds for `nth($list, $n)`',
name: 'Error',
stack: 'Error: bower_components/compass-mixins/lib/compass/functions/_lists.scss\n 34:12 index out of bounds for `nth($list, $n)`\n at options.error (/var/www/mdcurrent_dev/.modman/mdv14/skin/frontend/mdthemes/mdresponsive/build/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:277:32)',
showStack: false,
showProperties: true,
plugin: 'gulp-sass' }
Changing
@for $i from 2 through length($items) {
$item: nth($items, $i);
@if $item != null {
$full: $full $item;
}
}
To
@for $i from 1 through length($items) {
$item: nth($items, $i);
@if $item != null {
$full: $full $item;
}
}
Fixes it... typo?
actually, this is not just a typo, when I change to 1, I now get the first item in the list twice... column-rule: 1px 1px solid #eee; so you are intending to use 2, not sure why the first is repeated though and not sure how to stop the out of index error if I change to 2 -- I'm now reading up on sass systax in order to debug...
This seems to do what I want
@for $i from 1 through length($items) {
@if $i != 1 {
$item: nth($items, $i);
@if $item != null {
$full: $full $item;
}
}
}
I'm having the same issue with the latest version. The fix by @waynetheisinger works.
I think this work around is red herring for the real issue. Sass lists are 1 indexed so nth($list, length($list)) is within bounds. This is not the case for 0 indexed arrays common in other languages.
@xzyfer I'm using the fix by @waynetheisinger on a project temporarily. But I agree, we need to figure out where it's really coming from.