Last active
May 2, 2024 05:55
-
-
Save fatihacet/a5aa48d19fa0579c698c94ebcac08679 to your computer and use it in GitHub Desktop.
Use Scss map and map_get to get dynamic variables from map.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$white_foo_bar: #FFF; | |
$map: ( | |
foo: 'foo', | |
bar: 'bar', | |
baz: 'white', | |
foowhite: 'foowhitecolor' | |
); | |
@mixin foo($type) { | |
.foo { | |
.bar { | |
background: $white_foo_bar; | |
color: map-get($map, #{$type}white); | |
} | |
} | |
} | |
.div { | |
@include foo('foo'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.div .foo .bar { | |
background: #FFF; | |
color: "foowhitecolor"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment