Created
March 9, 2017 08:45
-
-
Save colinmeinke/f21baf122bc8ad56352d42dd30dbcc58 to your computer and use it in GitHub Desktop.
mixin v extend
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
// mixin | |
@mixin whitewash { | |
background-color: white; | |
border-color: white; | |
color: white; | |
} | |
.foo { | |
@include whitewash; | |
} | |
.bar { | |
@include whitewash; | |
} | |
// output | |
.foo { | |
background-color: white; | |
border-color: white; | |
color: white; | |
} | |
.bar { | |
background-color: white; | |
border-color: white; | |
color: white; | |
} | |
// extend with class | |
.whitewash { | |
background-color: white; | |
border-color: white; | |
color: white; | |
} | |
.foo { | |
@extend .whitewash; | |
} | |
.bar { | |
@extend .whitewash; | |
} | |
// output | |
.whitewash, .foo, .bar { | |
background-color: white; | |
border-color: white; | |
color: white; | |
} | |
// extend with placeholder | |
%whitewash { | |
background-color: white; | |
border-color: white; | |
color: white; | |
} | |
.foo { | |
@extend %whitewash; | |
} | |
.bar { | |
@extend %whitewash; | |
} | |
// output | |
.foo, .bar { | |
background-color: white; | |
border-color: white; | |
color: white; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment