I have a file main.sass and screen.sass Screen.sass I connect to main.sass via import

@import 'screen' 

There is a variable in main.css

 $green: #5dca88 

I use this variable in screen.sass like this:

 border-top: 1px solid $green 

But for some reason an error is obtained: sass \ screen.sass

 Error: Undefined variable: "$green". on line 26 of sass/screen.sass >> border-top: 1px solid $green; 

I tried to import before the variable was announced and after - nothing helps. Tell me what am I doing wrong? How to make it possible to use variables from the parent file in the internal files?

  • It is not clear, connect css to css , and in the error sass file. So what do you end up using? - E_K
  • I connect the sass. Already fixed in the question - Ira G
  • one
    Try renaming screen.sass to _screen.sass and then in the main.sass file main.sass first main.sass variable, and then make the import. - E_K
  • Thanks, it helped - Ira G

0