Sass Css Map Code Example


Example 1: scss maps´


// define one
$font-weights: ("regular": 400, "medium": 500, "bold": 700)

// get value
@debug map.get($font-weights, "medium") // 500
@debug map.get($font-weights, "extra-bold") // null

Example 2: scss how to use map


// _component.scss
$configuration: (
padding: 1em,
margin: 0 1em,
color: grey
);

.element
{
color: map-get($configuration, color);
padding: map-get($configuration, padding);
margin: map-get($configuration, margin);

&::before
{
background-color: map-get($configuration, color);
}
}

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android SDK Location Should Not Contain Whitespace, As This Cause Problems With NDK Tools