-
-
Notifications
You must be signed in to change notification settings - Fork 190
/
_list.scss
44 lines (35 loc) · 1023 Bytes
/
_list.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// https://kittygiraudel.com/2013/08/08/advanced-sass-list-functions/
// https://gist.github.com/Jakobud/ec056b52f3673cc369dc97f2c2428424
@function remove($list, $value, $recursive: false) {
$result: ();
@each $item in $list {
@if type-of($item) == list and $recursive {
$result: append($result, remove($item, $value, $recursive));
} @else if $item != $value {
$result: append($result, $item);
}
}
@return $result;
}
@function remove-list($list, $removeList, $recursive: false) {
@each $removeItem in $removeList {
$list: remove($list, $removeItem, $recursive);
}
@return $list;
}
@function to-string($list, $glue: '', $is-nested: false) {
$result: null;
@for $i from 1 through length($list) {
$e: nth($list, $i);
@if type-of($e) == list {
$result: $result#{to-string($e, $glue, true)};
} @else {
$result: if(
$i != length($list) or $is-nested,
$result#{$e}#{$glue},
$result#{$e}
);
}
}
@return $result;
}