import a variable from a _partial.scss file and use it within SASS method

Asked

Viewed 341 times

0

I’m starting to work with SASS and I’m having problems with the partial file structure. By my understanding, I did something like this:

_Colors.scss

$red: red;
$blue: blue

_Buttons.scss

@import "colors";

button{
    background:$red;
    color:$blue;
}

_style.scss

@import "colors";
@import "buttons";

Only that using this the SASS is showing error saying that I can not use the variables already found in the _Colors file... how to solve?

  • I could not reproduce this error, but I think it can be solved no matter the _Colors.scss in _Buttons.scss.

  • i imported _Colors.scss into _Buttons.scss but msemo so did not proceed. my solution was to restructure my application so that it would fit.

  • I did exactly the same structure and did not present the errors you commented, it might be something intermittent or some bug

  • It may be possible to resolve using !default in global variables. $red: red !default;

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.