Created
May 4, 2014 20:43
-
-
Save alexdiliberto/f779b11b075b677d7c8c to your computer and use it in GitHub Desktop.
DRY CSS output using Sass
This file contains 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
/** | |
Placeholder - Contains all static mixin name value pairs for a particular mixin | |
*/ | |
%box { | |
border: 1px solid; | |
padding: 1em; | |
margin: 1em; | |
} | |
/** | |
Mixin - Contains the dynamic user-provided variables only | |
*/ | |
@mixin module($bgcolor, $border) { | |
background-color: $bgcolor; | |
border-color: $border; | |
@extend %box; | |
} | |
/** | |
End Result: DRY CSS | |
*/ | |
.thisbox { | |
@include module(Tomato, #888); | |
} | |
.thatbox { | |
@include module(slategray, Tomato); | |
color: white; | |
} | |
.anotherbox { | |
@include module(beige, green); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment