Before modules were introduced to sass, you could make a themed stylesheet this way:
themeDark.scss:
$color: black;
baseButton.scss:
button {
color: $color;
}
button.scss:
@import './_themeDark.scss'
@import './_baseButton.scss'
Now, modules were introduced to sass and @import is getting deprecated. How to achieve the same effect using sass modules?
Im looking for a solution, where some files are used as partial stylesheets. In the main file they are combined to form a final stylesheet that will be imported.
What i have tried:
- use
@useinstead of@import. It does not work, because variables from other modules are not seen. - use mixins. The problem is that you have to pass all the variables through arguments and it is much harder to maintain than the solution above with
@import.