Skip to content

Instantly share code, notes, and snippets.

@andriilive
Last active October 11, 2023 09:08
Show Gist options
  • Save andriilive/e665459ac359c9c79c658e165457752c to your computer and use it in GitHub Desktop.
Save andriilive/e665459ac359c9c79c658e165457752c to your computer and use it in GitHub Desktop.
PHPSCSS
:root {
--text-color:#000;
--border-color:#ccc;
}
.element_1, .element_2 {
.vars-enabled & {
color:var(--text-color);
}
&__child {
.vars-enabled & {
border:1px solid var(--border-color);
}
}
}
.element {
$e_:&;
.group-scope & {
&__child {
border:1px solid var(--border-color);
}
}
}
/* RESULT: Scoped UP: .vars-enabled .element_1, .vars-enabled .element_1__child */
.element {
--fix-1:#000;
$e_:&;
&#{$e_}-fix {
--fix-2:#000;
}
}
/* RESULT: Trick .element.element-fix */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment