Skip to content

Instantly share code, notes, and snippets.

@finteractive
Last active August 29, 2015 14:27
Show Gist options
  • Save finteractive/1cd8c8779bf3cc4795ec to your computer and use it in GitHub Desktop.
Save finteractive/1cd8c8779bf3cc4795ec to your computer and use it in GitHub Desktop.
An Introduction to Sass Maps (Generated by SassMeister.com.)
// ----
// 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);
}
/*
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