Created
June 15, 2015 12:33
-
-
Save binary-solo/8edf4323b22e6e87cc0e to your computer and use it in GitHub Desktop.
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
| // ---- | |
| // Sass (v3.4.14) | |
| // Compass (v1.0.3) | |
| // ---- | |
| @function map-fetch($map, $keys) { | |
| $key: nth($keys, 1); | |
| $length: length($keys); | |
| $value: map-get($map, $key); | |
| @if ($length > 1) { | |
| $rest: (); | |
| @for $i from 2 through $length { | |
| $rest: append($rest, nth($keys, $i)) | |
| } | |
| @return map-fetch($value, $rest) | |
| } @else { | |
| @return $value; | |
| } | |
| } | |
| $notice-boxes: ( | |
| types: ( | |
| warning: ( | |
| border: yellow, | |
| background: lighten(yellow, 20) | |
| ), | |
| error: ( | |
| border: red, | |
| background: red | |
| ) | |
| ) | |
| ); | |
| @each $type in map-keys(map-get($notice-boxes, types)) { | |
| .notice-box-#{$type} { | |
| background-color: map-fetch($notice-boxes, types $type background); | |
| border: map-fetch($notice-boxes, types $type border); | |
| } | |
| } |
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
| .notice-box-warning { | |
| background-color: #ffff66; | |
| border: yellow; | |
| } | |
| .notice-box-error { | |
| background-color: red; | |
| border: red; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment