Created
December 12, 2013 00:42
-
-
Save indieisaconcept/7921332 to your computer and use it in GitHub Desktop.
Sass maps to the rescue
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 class="news"> | |
<div class="module-header">news</div> | |
</div> | |
<div class="sport"> | |
<div class="module-header">sport</div> | |
</div> | |
<div class="business"> | |
<div class="module-header">business</div> | |
</div> |
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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
// define a list of verticals | |
$verticals: ( | |
news : blue, | |
sport : green, | |
business : grey | |
); | |
// define a overrides | |
$verticals: map-merge($verticals, ( | |
news: green, | |
sport: yellow | |
)); | |
@each $vertical, $color in $verticals { | |
.#{$vertical} .module-header { | |
background: $color; | |
} | |
} |
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
.news .module-header { | |
background: green; | |
} | |
.sport .module-header { | |
background: yellow; | |
} | |
.business .module-header { | |
background: grey; | |
} |
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 class="news"> | |
<div class="module-header">news</div> | |
</div> | |
<div class="sport"> | |
<div class="module-header">sport</div> | |
</div> | |
<div class="business"> | |
<div class="module-header">business</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment