6

In my file var.sass I define the variable $black. I would like to use that variable in ALL of my components.sass files. To do so, do i need to write @import in every file or is there any better solution to do that?

We all know that I cannot use those variables inside components.sass when I import this kind of files to a global styles.sass file.

Reza Saadati
  • 1,224
  • 13
  • 27

2 Answers2

0

Somehow you will need to get your var.sass file into your component file(s). Personally, each of my modules requires its own styles.scss file, in each styles.scss I use the SASS @import to grab my global vars file. I have a boilerplate structure that I use for modules that already has the this css wire-up. But maybe there's a even fancier build-time way to include your global SASS ...

Ted Fitzpatrick
  • 910
  • 1
  • 8
  • 18
0

As far as I'm aware, this is not possible. The workaround is something you've already done - I'm using a variables.scss file that I import to all components that need these variables (shout out to NetBasal for a short article describing this).

SimProch
  • 96
  • 3