Skip to content

Instantly share code, notes, and snippets.

@khamer
Created May 26, 2021 14:56
Show Gist options
  • Save khamer/62b85ad884d76e846526d5ff9df6ee13 to your computer and use it in GitHub Desktop.
Save khamer/62b85ad884d76e846526d5ff9df6ee13 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
@use "sass:map";
@use "sass:list";
@function hydrate($base, $map) {
$new: ();
@each $key, $value in $base {
$new: list.append($new, $value or map-get($map, $key) or $key);
}
@return $new;
}
$colors: (
primary: red,
secondary: blue,
tertiary: orange,
);
.foo {
stuff: hydrate(primary green tertiary, $colors);
bar: map-get($colors, primary) or foo;
bar: map-get($colors, orange) or orange;
}
.foo {
stuff: red green orange;
bar: red;
bar: orange;
}
{
"sass": {
"compiler": "dart-sass/1.32.12",
"extensions": {},
"syntax": "SCSS",
"outputStyle": "expanded"
},
"autoprefixer": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment