Skip to content

Instantly share code, notes, and snippets.

@glueckpress
Created April 21, 2013 08:27
Show Gist options
  • Select an option

  • Save glueckpress/5428896 to your computer and use it in GitHub Desktop.

Select an option

Save glueckpress/5428896 to your computer and use it in GitHub Desktop.
How to prepend i.e. a .js class to the first level of a nested selector in SASS.
/**
* Prepend a selector to the first level of nested selectors.
* Comments demonstrate compiled CSS.
*/
.foo {
/* .foo */
.bar {
/* .foo .bar */
.js & { /* .js .foo .bar */ }
&.foobar {
.js & { /* .js .foo .bar.foobar */ }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment