Created
February 27, 2015 20:29
-
-
Save elseloop/71867cf391be9b9e7e61 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
| <div class="thing"></div> | |
| <div class="other-thing"></div> | |
| <div class="thing-three"></div> |
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.12) | |
| // Compass (v1.0.3) | |
| // ---- | |
| $icons: ( one: "hey!", two: url(http://www.fillmurray.com/400/250), three: one ); @function icon($icon, $iconMap: $icons) { // check $icon exists in $iconMap @if map-has-key($iconMap, $icon) { $icon: map-get($icons, $icon); // recursive call to check for self-referencing icon keys // i.e.: $icons: ( check: "\e007", tick: check ) // @include icon(tick) will return check => "\e007" @if map-has-key($icons, $icon) { $icon: icon($icon); } } @else { @warn "The icon you called -- #{$icon} -- is not in the #{$iconMap} icon map."; @return null; } @return $icon; } @mixin icon($name, $pseudo: before, $iconMap: $icons) { &:#{$pseudo} { content: icon($name, $iconMap); @content; // allows additional CSS declarations to be passed as well } } .thing { @include icon(one) { color: red; display: block; font-family: sans-serif; font-size: 2rem; margin-bottom: .5rem; text-transform: uppercase; }; } .other-thing { &:after { content: icon(two); } } .thing-three { @include icon(three) { color: cornflowerblue; display: block; font-family: sans-serif; font-size: 2rem; margin-top: .5rem; text-transform: uppercase; }; } |
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
| .thing:before { | |
| content: "hey!"; | |
| color: red; | |
| display: block; | |
| font-family: sans-serif; | |
| font-size: 2rem; | |
| margin-bottom: .5rem; | |
| text-transform: uppercase; | |
| } | |
| .other-thing:after { | |
| content: url(http://www.fillmurray.com/400/250); | |
| } | |
| .thing-three:before { | |
| content: "hey!"; | |
| color: cornflowerblue; | |
| display: block; | |
| font-family: sans-serif; | |
| font-size: 2rem; | |
| margin-top: .5rem; | |
| text-transform: uppercase; | |
| } |
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
| <div class="thing"></div> | |
| <div class="other-thing"></div> | |
| <div class="thing-three"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment