Last active
August 29, 2015 14:16
-
-
Save tsmith512/3c044df6fb5602d0eb18 to your computer and use it in GitHub Desktop.
Proposal for a better rtl() mixin that takes a class name
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
// ---- | |
// Sass (v3.4.12) | |
// Compass (v1.0.3) | |
// ---- | |
@mixin rtl($class: '') { | |
#{'html[dir="rtl"]' + $class} & { | |
@content; | |
} | |
} | |
.view { | |
text-align: left; | |
@include rtl { | |
text-align: right; | |
} | |
} | |
.fanciness { | |
html.flexbox & { | |
color: red; | |
} | |
@include rtl('.flexbox') { | |
color: blue; | |
} | |
} |
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
.view { | |
text-align: left; | |
} | |
html[dir="rtl"] .view { | |
text-align: right; | |
} | |
html.flexbox .fanciness { | |
color: red; | |
} | |
html[dir="rtl"].flexbox .fanciness { | |
color: blue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment