Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
web
/
vhosts
/
www.shinegis.mu
/
htdocs
/
functions
/
scssphp
/
tests
/
inputs
/
/srv/data/web/vhosts/www.shinegis.mu/htdocs/functions/scssphp/tests/inputs/looping.scss
div { $var: red; @each $var in what is this { color: $var; } @each $var in what, is, this { font: $var; } $list: what is this; @each $var in $list { background: $var; } $list: what, is, this; @each $var in $list { border: $var; } @each $var in what what, is is, this this { background: $var; } @each $var in (what: what, is: is, this: this) { background: $var; } @each $header, $size, $nonexistent in (h1: 2em, h2: 1.5em, h3: 1.2em) { #{$header} { font-size: $size; border: $nonexistent; } } color: $var; } span { $i: 0; @while $i <= 10 { color: $i; $i: $i + 1; } } pre { @for $x from 1 to 5 { color: $x; } @for $x from 1 through 5 { height: $x; } $y: 10; @for $x from $y through 3 { cool: $x; } } $j: null; @while $j { .item { width: 2em; } $j: false; } @function contains($list, $values...) { @each $value in $values { @if type-of(index($list, $value)) != "number" { @return false; } } @return true; } @function is-number($value) { @return contains("0" "1" "2" "3" "4" "5" "6" "7" "8" "9" 0 1 2 3 4 5 6 7 8 9, $value); } div { a: is-number('red'); b: is-number('1'); c: is-number("3"); c: is-number(5); } // looping on map with key being a map also $oc-gray-list: ( "0": #f8f9fa, "1": #f1f3f5 ); $oc-red-list: ( "0": #fff5f5, "1": #ffe3e3 ); $oc-color-list: ( $oc-gray-list: "gray", $oc-red-list: "red" ); @each $color-list, $color-name in $oc-color-list { @each $color-index, $color in $color-list { .bg-#{$color-name}-#{$color-index} { background-color: $color; } } } // loop on map with string as key $str-color-list: ( "blue": #44e, "green": #8d8, "black": #333 ); $str-color-elements: ( "a": ("blue", "black"), "div": ("green", "black") ); @each $el, $colors in $str-color-elements { @each $color-name, $color in $str-color-list { @if(index($colors, $color-name) != null) { #{$el}.#{$el}-#{$color-name} { color: $color; } } } }