Say I have an index
scss file in which all my other smaller scss partials are imported into:
@import "color-vars";
@import "scss_that_uses_the_color_vars";
scss_that_uses_the_color_vars
looks as follows:
p {
background-color: $mainColor; // ERROR: undefined variable $mainColor
}
However, I did define $mainColor
in color-vars
which I imported before scss_that_uses_the_color_vars
in the index
file ... how can I make it work whilst preserving the modularity?
I say "whilst preserving modularity" because I don't want to simply insert @import "color-vars";
in scss_that_uses_the_color_vars
, since that would make it very hard to debug when all my smaller modules import each other. I.e. that would result in a total mess! Therefore, I would like to define the flow of imports in the index
file, but this, unfortunately, doesn't seem to be possible?
question from:
https://stackoverflow.com/questions/65925240/import-variables-into-main-file-and-have-them-available-in-other-file-that-are-i 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…