Created
November 30, 2015 11:31
-
-
Save jmahony/7aafe04235bfae8c0f8a to your computer and use it in GitHub Desktop.
Mixin that wraps content another selector
This file contains hidden or 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
| @mixin wrap($prefix) { | |
| $selector: &; | |
| @at-root #{$prefix} { | |
| #{$selector} { | |
| @content; | |
| } | |
| } | |
| } | |
| @mixin ie9() { | |
| @include wrap($prefix: '.ie9') { | |
| @content; | |
| } | |
| } | |
| // This | |
| .a { | |
| .b { | |
| transform: translate3d(0, 0, 0); | |
| @include ie9 { | |
| transform: translate(0, 0); | |
| } | |
| } | |
| } | |
| // would compile to | |
| .a .b { | |
| transform: translate3d(0, 0, 0); | |
| } | |
| .ie9 .a .b { | |
| transform: translate(0, 0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment