Skip to content

Instantly share code, notes, and snippets.

@scottkellum
Created October 17, 2012 18:43
Show Gist options
  • Save scottkellum/3907301 to your computer and use it in GitHub Desktop.
Save scottkellum/3907301 to your computer and use it in GitHub Desktop.
mixins with extend
%box {
width: 500px;
height: 400px;
}
%box-border {
border: 3px solid #f00;
}
%clearfix {
@include clearfix;
}
// more complex extend behavior consolidated in a mixin.
@mixin box($color: false, $border: false) {
@extend %box;
// optional styles and things
@if $border {
@extend %box-border;
}
@if $color != false {
background-color: $color;
}
}
// now the clearfix mixin will extend %clearfix, also mixins keep syntax consistent.
@mixin clearfix {
@extend %clearfix;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment