Skip to content

Instantly share code, notes, and snippets.

@mistergraphx
Last active August 29, 2015 14:09
Show Gist options
  • Save mistergraphx/18115900c697ac3d4104 to your computer and use it in GitHub Desktop.
Save mistergraphx/18115900c697ac3d4104 to your computer and use it in GitHub Desktop.
SASS %extends inside descendant and child selectors.
[data-bar="global"] [data-foo="local"] > .class1 {
background: blue;
}
[data-foo="local"] [data-bar="global"] .class2, [data-bar="global"] [data-foo="local"] .class2 {
background: blue;
}
/*
*/
%child-selector {
[data-foo="local"] > & {
background: blue;
}
}
.class1 {
[data-bar="global"] & {
@extend %child-selector;
}
}
%descendant-selector {
[data-foo="local"] & {
background: blue;
}
}
.class2 {
[data-bar="global"] & {
@extend %descendant-selector;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment