Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generic mixin to increase the specificity of the contents rules
// Increase class-level specificity of a rule without functionaly modifying the selector
@mixin increase-specificity( $depth: 1 ) {
$sel : '';
@while($depth > 0) {
$sel : $sel + ':nth-child(n)';
$depth : $depth - 1;
}
&#{$sel} {
@content;
}
}
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.