Created
August 5, 2014 12:36
-
-
Save cahnory/c8abd8a1b347dda96b81 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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.3.14) | |
// Compass (v1.0.0.rc.1) | |
// ---- | |
// attribute used instead of `class` | |
$class-attr: 'data-g'; | |
// return attribute selector | |
@function g($class) { | |
@return '[#{$class-attr}~="#{$class}"]'; | |
} | |
@mixin g($class, $direct: false) { | |
#{if($direct, '&', '')}#{g($class)} { | |
@content; | |
} | |
} | |
@mixin _g($class) { | |
@include g($class, true) { | |
@content; | |
} | |
} | |
a { | |
@include _g(foo) { | |
color: blue; | |
} | |
} | |
a { | |
@include _g(foo) { | |
color: yellow; | |
} | |
} | |
a { | |
@include _g(foo) { | |
@include _g(bar) { | |
color: green; | |
} | |
} | |
} |
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
a[data-g~="foo"] { | |
color: blue; | |
} | |
a[data-g~="foo"] { | |
color: yellow; | |
} | |
a[data-g~="foo"][data-g~="bar"] { | |
color: green; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment