Created
August 14, 2013 17:33
-
-
Save Harrisonbro/6233386 to your computer and use it in GitHub Desktop.
Generate a solid class (for use in markup) and a silent class (for use with @extend) in one go.
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
| /** | |
| * Generate a solid class (for use in markup) and a silent class (for use with | |
| * `@extend`) in one go. | |
| * | |
| * Created by csswizardry at http://jsfiddle.net/csswizardry/ECntr/ | |
| */ | |
| @mixin class($name) { | |
| .#{$name}, | |
| %#{$name} { | |
| @content | |
| } | |
| } | |
| /** | |
| * Example usage: | |
| */ | |
| @include class(foo) { | |
| color: red; | |
| &:hover { | |
| color: black; | |
| } | |
| } | |
| @include class(foo--bar) { | |
| font-weight: bold; | |
| } | |
| .bar { | |
| @extend %foo; | |
| @extend %foo--bar; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment