Skip to content

Instantly share code, notes, and snippets.

@laurentperroteau
Last active August 29, 2015 13:56
Show Gist options
  • Save laurentperroteau/8825348 to your computer and use it in GitHub Desktop.
Save laurentperroteau/8825348 to your computer and use it in GitHub Desktop.
Use "root" for preprocessor
// SASS/SCSS, less or stylus
.children-class {
color: red;
.parent-class & {
color: green;
}
}
=> compile in CSS
.children-class { color: red }
.parent-class .children-class { color: green }
// Do not confuse with "at-root" of SASS/SCSS for BEM
.level-1 {
color: red;
@at-root #{&}__level-2 {
color: green;
}
}
=> compile in CSS
.level-1 { color: red }
.level-1__level-2 { color: green }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment