SassError: Undefined variable: "$main-background-color"

17,306

I believe you need to import the _variables.scss directly into _styles.scss if you want to use them there

Share:
17,306
Karen
Author by

Karen

Updated on June 09, 2022

Comments

  • Karen
    Karen almost 2 years

    I'm trying to use CSS-variables during the LoginPage component styling but receiving the following error: SassError: Undefined variable: "$main-background-color". This error appears in the _styles.scss file.

    this is my project structure:

    project structure

    I'm importing both _variables.scss and styles.scss to the main index.scss file:

    index.scss

    What I'm doing wrong while importing variables? Why I can't use them in the _styles.scss file?