Created
January 28, 2013 22:16
-
-
Save kara-ryli/4659715 to your computer and use it in GitHub Desktop.
Never put code before an ampersand when using SCSS nesting. Therein lies madness.
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
<div class="wrap"> | |
<div class="bar"> | |
<div class="foo">Text!</div> | |
</div> | |
</div> |
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
// this looks safe | |
.foo { | |
.bar & { | |
color: red; | |
} | |
} // .bar .foo { color: red; } \(^.^)/ | |
// until you need to wrap all your selectors in a namespaced container | |
.wrap { | |
.foo { | |
.bar & { | |
color: red; | |
} | |
} | |
} // .bar .wrap .foo { color: red; } (╯°□°)╯︵ ┻━┻ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment