Skip to content

Instantly share code, notes, and snippets.

@kara-ryli
Created January 28, 2013 22:16
Show Gist options
  • Save kara-ryli/4659715 to your computer and use it in GitHub Desktop.
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.
<div class="wrap">
<div class="bar">
<div class="foo">Text!</div>
</div>
</div>
// 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