Created
October 17, 2012 18:43
-
-
Save scottkellum/3907301 to your computer and use it in GitHub Desktop.
mixins with extend
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
%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