Skip to content

Instantly share code, notes, and snippets.

@Harrisonbro
Created August 14, 2013 17:33
Show Gist options
  • Select an option

  • Save Harrisonbro/6233386 to your computer and use it in GitHub Desktop.

Select an option

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.
/**
* 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