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

Possible typo leading to error #64

Open
waynetheisinger opened this issue Sep 24, 2015 · 5 comments
Open

Possible typo leading to error #64

waynetheisinger opened this issue Sep 24, 2015 · 5 comments

Comments

@waynetheisinger
Copy link

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?

@waynetheisinger
Copy link
Author

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...

@waynetheisinger
Copy link
Author

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;
        }
      }
    }

@shadcn
Copy link

shadcn commented Jun 17, 2016

I'm having the same issue with the latest version. The fix by @waynetheisinger works.

shadcn added a commit to shadcn/compass-mixins that referenced this issue Jun 17, 2016
@xzyfer
Copy link
Collaborator

xzyfer commented Jun 17, 2016

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.

@shadcn
Copy link

shadcn commented Jun 17, 2016

@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.

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

No branches or pull requests

3 participants