Created
December 17, 2015 15:18
-
-
Save autovalue/15c9db923d9aa64696cb to your computer and use it in GitHub Desktop.
SASS mixin for appending a selector to the parent of the current rule set.
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
/// Nested [mixin] | |
/// -------------- | |
/// Prepend a css rule to the current rule set. | |
/// @content : <content> | |
/// @param $selector : <span> | |
/// @param $isParent : <span> Whether the $selector will be applied as a parent or not. | |
@mixin prepend-selector($selector, $isParent: true) { | |
@if($isParent) { | |
@at-root #{$selector} & { | |
@content; | |
} | |
} @else { | |
@at-root #{$selector}#{&} { | |
@content; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment