The new use of the &
and @at-root
in Sass is pretty much blowing my mind!
Last active
December 30, 2015 07:39
-
-
Save blackfalcon/7797067 to your computer and use it in GitHub Desktop.
Sass 3.3 at-root feature
This file contains 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
// ---- | |
// 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; | |
} | |
} | |
} |
This file contains 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
@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; | |
} |
This file contains 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
<h1>The <code>&</code> and <code>@at-root</code></h1> | |
<p>The new use of the <code>&</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