2

I've got the following variable list:

$list: 'one', 'two', 'three'

And I need to use this list, but with one more value, temporarily, how can I do something like this?

$list: 'one', 'two', 'three'
$list-group: $list, 'four'

@for $i from 1 through length($list-group)
    .color-#{ nth($list-group, $i) }
        content: nth($list-group, $i)

1 Answer 1

1

You can use insert-nth or append

append:

append($list, 'four', [$separator])

insert-nth:

$list: 'one', 'two', 'three';
$list-group: insert-nth($list, 4, 'four');
Sign up to request clarification or add additional context in comments.

1 Comment

insert-nth; is not an inbuilt method like append. so insert-nth does not work by itself, you need to provide a function to run this without error. Check out this article here this might help hugogiraudel.com/2013/08/08/advanced-sass-list-functions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.