Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generated by SassMeister.com.
// ----
// libsass (v3.3.2)
// ----
@function nth-selector($str, $n) {
@for $i from 1 through $n {
@if (str_index($str, ' ')) {
@if $i == $n {
$str: str_slice($str, 0, str_index($str, ' ') - 1);
} @else {
$str: str_slice($str, str_index($str, ' ') + 1);
}
}
}
@return unquote($str);
}
.grand-parent {
.parent {
content: '' + nth-selector(#{&}, 1);
#{nth-selector(#{&}, 2)} .cc {
width: 20px;
}
@at-root #{nth-selector(#{&}, 2)} .cc {
width: 10px;
}
}
}
.grand-parent .parent {
content: ".grand-parent";
}
.grand-parent .parent .parent .cc {
width: 20px;
}
.parent .cc {
width: 10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.