Last active
August 29, 2015 14:16
-
-
Save davidicus/3582100f1ab84e8171d4 to your computer and use it in GitHub Desktop.
get last part of selector and Then use the double ampersand mixin.
This file contains 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
/// Grab the last part of a selector | |
/// | |
/// @param {List} $selector | |
/// @returns String | |
@function x-tail($selector) { | |
@return nth(nth($selector, -1), -1); | |
} | |
/// Double | |
/// @param {Number} $margin [null] | |
@mixin x-doubly($margin: null) { | |
& + #{x-tail(&)} { | |
margin-left: $margin; | |
@content; | |
} | |
} | |
// Simple usage | |
ul li { | |
@include x-doubly(10px) { | |
foo: bar; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment