Created
February 18, 2021 23:01
-
-
Save umairhm/899dc83facb37b8b19da9c864a679806 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin if-direct-parent($parent-selectors) { | |
$current-sequences: &; | |
$new-sequences: (); | |
@each $parent-selector in $parent-selectors { | |
@each $sequence in $current-sequences { | |
$current-selector: nth($sequence, -1); | |
$prepended-selector: join($parent-selector, $current-selector); | |
$new-sequence: set-nth($sequence, -1, $prepended-selector); | |
$new-sequences: append($new-sequences, $new-sequence, comma); | |
} | |
} | |
@at-root #{$new-sequences} { | |
@content; | |
} | |
} | |
@mixin some-component-a { | |
.some-component { | |
display: inline; | |
@include if-direct-parent(['body[lang=fr]']) { | |
div { | |
display: flex; | |
} | |
} | |
& div { | |
display: block; | |
} | |
&__span { | |
display: inline-block; | |
} | |
} | |
} | |
html[brand="a"] { | |
@include some-component-a(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html[brand=a] .some-component { | |
display: inline; | |
} | |
html[brand=a] body[lang=fr] .some-component div { | |
display: flex; | |
} | |
html[brand=a] .some-component div { | |
display: block; | |
} | |
html[brand=a] .some-component__span { | |
display: inline-block; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"sass": { | |
"compiler": "dart-sass/1.26.11", | |
"extensions": {}, | |
"syntax": "SCSS", | |
"outputStyle": "expanded" | |
}, | |
"autoprefixer": false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment