Use SASS variables between files without importing or referencing the variable file?
Is it possible to exchange data between files without importing a variable file in each file? Here's an example:
Variables.scss
$primary: #0000FF;
HelpPage.scss
#help-page-container {
background: $primary;
}
Core.scss
@import "Variables.scss";
@import "HelpPage.scss";
Core.scss
is the only file that is compiled. All of my single page files, common CSS classes and Variables.scss
are included in this file.
If I want to use $primary
inside my HelpPage.scss file , I will need to either do:
@import "Variables.scss";
or
/// <reference path="Variables.scss" />
Either one works. However, if I have 20 pages, I will need to import / reference the variables file at the top of each one, just to make Visual Studio happy and not thrown away
Undeclared variable
I have a mistake.
source to share
Have you read this? http://thesassway.com/beginner/how-to-structure-a-sass-project
In essence, you would be imported _variables.scss
and _help-page.scss
in core.scss
Thus, part of the help partially has access to all variables.
source to share