Zachary Lordford
Zachary Lordford

Reputation: 146

Sass Map (scss map-get) use in other scss import

i have the index.scss that I've import login.scss , my question is how do map-get the color from index.scss ?

index.scss

@import "./style/login";

    $colors: (
        primary : #005DFF,
        accent : #FFF6BB
    );

this is what i done but i receive an error : "File to import not found or unreadable: ./style/login."

login.scss

.bg { 
background-color: map-get($colors, primary );
}

thank you in advance

Upvotes: 0

Views: 2613

Answers (1)

jack
jack

Reputation: 2914

That error means the file isn't at the path you're pointing to. Is index.scss in the same directory as login.scss? If the file path is correct, it might be an issue with your build process. If you can, please add a screenshot of the folder where these files are, so we can see if the path is right.

Once you have that sorted, you'll need to edit this sass to make it work right. In index.scss, you need to declare your $colors map above your @import login. Otherwise, when login gets imported, it doesn't know what $colors is supposed to be.

Upvotes: 1

Related Questions