Created
December 3, 2014 02:19
-
-
Save gisu/e0035e021402f82f0698 to your computer and use it in GitHub Desktop.
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
/** | |
* Smart Append Selectors | |
* | |
* @param {string} $name - Name of the Tag | |
* @param {string|bool} $mod - Name of the modifier | |
* @param {bool} $context - For nested selector | |
* @param {string} $name - Name from the Tag | |
*/ | |
@mixin append($tag, $mod: false, $context: false) { | |
@if $context { | |
@if $mod { | |
> [#{$tag}~='#{$mod}'] { | |
@content; | |
} | |
} @else { | |
> [#{$tag}] { | |
@content; | |
} | |
} | |
} @else { | |
@at-root { | |
@if $mod { | |
[#{$tag}~='#{$mod}'] { | |
@content; | |
} | |
} @else { | |
[#{$tag}] { | |
@content; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment