Skip to content

Instantly share code, notes, and snippets.

@davidicus
Last active August 29, 2015 14:16
Show Gist options
  • Save davidicus/3582100f1ab84e8171d4 to your computer and use it in GitHub Desktop.
Save davidicus/3582100f1ab84e8171d4 to your computer and use it in GitHub Desktop.
get last part of selector and Then use the double ampersand mixin.
/// 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