Skip to content

Instantly share code, notes, and snippets.

@Rplus
Created January 12, 2016 18:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Rplus/0e029eeb0686fe81f874 to your computer and use it in GitHub Desktop.
Save Rplus/0e029eeb0686fe81f874 to your computer and use it in GitHub Desktop.
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