Last active
August 29, 2015 14:27
-
-
Save finteractive/1cd8c8779bf3cc4795ec to your computer and use it in GitHub Desktop.
An Introduction to Sass Maps (Generated by SassMeister.com.)
This file contains hidden or 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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
/* | |
Source: http://webdesign.tutsplus.com/tutorials/an-introduction-to-sass-maps-usage-and-examples--cms-22184 | |
Topic: An Introduction to Sass Maps: Usage and Examples | |
*/ | |
/* Generating a map | |
$map: ( | |
key: value, | |
nextkey: nextvalue | |
); | |
*/ | |
$map: ( | |
key: value, | |
nextkey: nextvalue | |
); | |
/* Check if Ket is available*/ | |
.element { | |
@if map-has-key($map, key) { | |
content: 'Map has this key.'; | |
} @else { | |
content: 'Map has not this key.'; | |
} | |
} | |
/* Merge Maps Together */ | |
$colors: ( | |
light: #ccc, | |
dark: #000 | |
); | |
$brand-colors: ( | |
main: red, | |
alternative: blue | |
); | |
// Merge maps | |
$merged: map-merge($colors, $brand-colors); | |
.element { | |
background-color: map-get($merged, alternative); | |
color: map-get($merged, light); | |
} |
This file contains hidden or 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
/* | |
Source: http://webdesign.tutsplus.com/tutorials/an-introduction-to-sass-maps-usage-and-examples--cms-22184 | |
Topic: An Introduction to Sass Maps: Usage and Examples | |
*/ | |
/* Generating a map | |
$map: ( | |
key: value, | |
nextkey: nextvalue | |
); | |
*/ | |
/* Check if Ket is available*/ | |
.element { | |
content: 'Map has this key.'; | |
} | |
/* Merge Maps Together */ | |
.element { | |
background-color: blue; | |
color: #ccc; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment