Created
April 9, 2021 17:28
-
-
Save joshblack/ab50a4eca473b6ef85381954ac571e56 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains 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
$theme: ( | |
ui-01: black, | |
); | |
$light: ( | |
ui-01: white, | |
); | |
@mixin theme($theme-to-apply) { | |
$saved-theme: $theme; | |
$theme: $theme-to-apply; | |
$ui-01: map-get($theme-to-apply, ui-01) !global; | |
@content; | |
$theme: $saved-theme; | |
} | |
$ui-01: map-get($theme, ui-01) !default; | |
@mixin my-component-v1 { | |
.my-component-v1 { | |
background: $ui-01; | |
} | |
} | |
@mixin my-component-v2 { | |
.my-component-v1 { | |
background: $new-ui-token; | |
} | |
} | |
// Current version | |
@include my-component-v1; | |
.light { | |
@include theme($light) { | |
@include my-component-v1; | |
} | |
} | |
// Changed to use "new version" | |
@include my-component-v2; | |
.light { | |
@include theme($light) { | |
@include my-component-v2; | |
} | |
} |
This file contains 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
.my-component-v1 { | |
background: black; | |
} | |
.light .my-component-v1 { | |
background: white; | |
} | |
.my-component-v1 { | |
background: white; | |
} | |
.light .my-component-v1 { | |
background: white; | |
} |
This file contains 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