Reputation: 12323
I try to make different config files (for different colors) and use the variables in another file I import basic.scss, Im going to make multiple app.scss files like app1.scss and app2.scss which use different config files with different colors.
My config1.scss
$primary-color : #6a7dcc;
$primary-font-color: #ccc;
my basic.scss
body {
background-color: $primary-color;
color: $primary-font-color;
}
my app1.scss
@import "config2.scss";
@import "basic.scss";
This gives me the error:
Error: Undefined variable: "$primary-color". on line 2 of app/css/basic.sc
How can I use imported variables in other imported files?
Upvotes: 1
Views: 3499
Reputation: 4176
Looks like you have a config1
and config2
. Unless that is a typo, once you change your @import config2.scss
to @import config1.scss
it should work.
Tl;dr you arent importing the file where the variables were declared. Do that and it should work.
Upvotes: 0
Reputation: 377
File Config1.scss is having variable $primary-color and your are importing config2.scss (which is not having variable $primary-color) in your app1.scss, i think that is the reason
Upvotes: 0