I am looking for a way to generate variables dynamically from a sass map. So far I have looked into multiple examples, but all use a function like weight(map-get($map, 'key'))
to get what is wanted. Instead I would like to generate the variable. For example
font-weight:$__weight--thin;
Notice the variable above. I would like to generate from a sass map like below:
//Font Weights
$__map--font-weights:(
xthin: 100,
thin: 200,
light: 300,
regular: 400,
medium: 500,
semibold: 600,
bold: 700,
xbold: 800,
xxbold: 900
);
This map should spit out variables like:
$__weight--thin: 200;
$__weight--light: 300;
...
So far this is what I have:
@mixin makeWeights() {
@each $key, $value in $__map--font-weights {
$#{key}: $value
}
}