In the below example value in map $color-array
is treated as list of pairs.
SCSS Input
$color-array:(
black: #4e4e4e,
blue: #0099cc,
green: #2ebc78
);
@each $color-name, $color-value in $color-array {
.bg-#{$color-name} {
background: $color-value;
}
}
CSS Output
.bg-black {
background: #4e4e4e;
}
.bg-blue {
background: #0099cc;
}
.bg-green {
background: #2ebc78;
}