Created
December 11, 2014 22:18
-
-
Save davidkpiano/08aee2e0b393924cec84 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
// ---- | |
// Sass (v3.4.7) | |
// Compass (v1.0.1) | |
// ---- | |
// Let's say I have a button component... | |
%button { | |
display: inline-block; | |
padding: 1rem; | |
border: 1px solid gray; | |
color: black; | |
background: #EFEFEF; | |
// ...etc. | |
} | |
// And I have a button group component that stacks all buttons inside | |
// and makes their backgrounds pink (for whatever reason)... | |
%buttonGroup { | |
display: block; | |
border: 2px solid gray; | |
// ...etc. | |
// Here is where the inner buttons are changed. | |
%button { | |
display: block; | |
background: pink; | |
} | |
} | |
//------------------------------------ | |
// In a separate file, far far away... | |
//------------------------------------ | |
// I can change the selectors just in this place, and | |
// the relationship between buttons and buttonGroups are preserved | |
button, input[type=button], input[type=submit], .button { | |
@extend %button; | |
} | |
.buttonGroup { | |
@extend %buttonGroup; | |
} | |
#epilogue { | |
content: 'Yes, @extend has great potential to be misused, especially when it can easily be'; | |
content: 'substituted for a @mixin, but using placeholders for RELATIONSHIPS between'; | |
content: 'components is much, much simpler than using mixins.'; | |
} |
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
button, input[type=button], input[type=submit], .button { | |
display: inline-block; | |
padding: 1rem; | |
border: 1px solid gray; | |
color: black; | |
background: #EFEFEF; | |
} | |
.buttonGroup { | |
display: block; | |
border: 2px solid gray; | |
} | |
.buttonGroup button, .buttonGroup input[type=button], .buttonGroup input[type=submit], .buttonGroup .button { | |
display: block; | |
background: pink; | |
} | |
#epilogue { | |
content: 'Yes, @extend has great potential to be misused, especially when it can easily be'; | |
content: 'substituted for a @mixin, but using placeholders for RELATIONSHIPS between'; | |
content: 'components is much, much simpler than using mixins.'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment