Skip to content

Instantly share code, notes, and snippets.

@jasonkmccoy
Last active August 29, 2015 14:16
Show Gist options
  • Save jasonkmccoy/8fd78a5b9bbe6db4f0ca to your computer and use it in GitHub Desktop.
Save jasonkmccoy/8fd78a5b9bbe6db4f0ca to your computer and use it in GitHub Desktop.
Sass 3.3 at-root feature. The new use of the & and @at-root in Sass is pretty much blowing my mind!
@media print {
.page {
width: 8in;
}
}
.page {
color: red;
}
.block-name[role=navigation] {
color: blue;
}
.block-name__element {
color: red;
}
.block-name__element__element {
color: orange;
}
.block-name__element {
color: brown;
}
.block-name__element--modifer {
color: yellow;
}
<h1>The <code>&amp;</code> and <code>@at-root</code></h1>
<p>The new use of the <code>&amp;</code> and <code>@at-root</code> in Sass is pretty much blowing my mind!</p>
<p><a href="http://sassmeister.com/gist/7797067">play here</a></p>
// ----
// Sass (v3.3.7)
// Compass (v1.0.0.alpha.18)
// ----
@media print {
.page {
width: 8in;
@at-root (without: media) {
color: red;
}
}
}
.block-name {
&[role=navigation] {
color: blue;
}
&__element {
color: red;
&__element {
color: orange;
}
}
&__element {
color: brown;
&--modifer {
color: yellow;
}
}
}
<h1>The <code>&amp;</code> and <code>@at-root</code></h1>
<p>The new use of the <code>&amp;</code> and <code>@at-root</code> in Sass is pretty much blowing my mind!</p>
<p><a href="http://sassmeister.com/gist/7797067">play here</a></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment