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

@if index($span, 'last') does not work #683

Open
jvandenrym opened this issue Jan 9, 2019 · 1 comment
Open

@if index($span, 'last') does not work #683

jvandenrym opened this issue Jan 9, 2019 · 1 comment

Comments

@jvandenrym
Copy link

I have created a gist with susy 3 and a span mixin.
https://gist.github.com/jvandenrym/64070b3cc0920ba7752bd2b495ca3ab1

The checking of the last item does not do anything. Not sure I can even use this expression.
@if index($span, 'last') {

@jvandenrym jvandenrym changed the title @if index($span, 'last') { @if index($span, 'last') Jan 9, 2019
@jvandenrym jvandenrym changed the title @if index($span, 'last') @if index($span, 'last') does not do anything Jan 9, 2019
@jvandenrym jvandenrym changed the title @if index($span, 'last') does not do anything @if index($span, 'last') does not work Jan 9, 2019
@mirisuzanne
Copy link
Member

mirisuzanne commented Jan 9, 2019

Yeah, if index($span, 'last') relies on the user explicitly adding last to the span argument. A more robust approach would probably look like this (tested and updated):

  $span: map-get($context, 'span');
  $location: map-get($context, 'location') or 1;
  $end: $span + $location - 1; 
  $is-last: ($end == length(map-get($context, 'columns')));

You shouldn't need the to-list helper. susy-compile() should already normalize everything

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

2 participants