Last active
July 1, 2020 13:20
-
-
Save stoyanvi/3c24774c3f4a110e447d to your computer and use it in GitHub Desktop.
Prevent styles from being loaded multiple times for components that rely on other components.
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
// IMPORT ONCE | |
// Prevent styles from being loaded multiple times for components that rely on other components. | |
$modules: () !default; | |
@mixin exports($name) { | |
$module_index: index($modules, $name); | |
@if not index($modules, $name) { | |
$modules: append($modules, $name) !global; | |
@content; | |
} | |
} |
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
// File: components/_fancy-button.scss | |
@include exports('fancy-button') { | |
.fancyButton { | |
@include koko(#000); | |
} | |
} |
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
@import 'components/_fancy-button.scss'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment