gespinha
gespinha

Reputation: 8487

SASS add variable to list

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)

Upvotes: 2

Views: 3483

Answers (1)

Guy
Guy

Reputation: 11315

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');

Upvotes: 1

Related Questions