Quentin
Quentin

Reputation: 1310

Scss global variables across files

This is in VS 2013 update 3. I declared the variables in _variables.scss:

$fontFamily: "Times New Roman", Times, serif;
$shapeColor: #ACAEAA;
...

Then it is imported at the very beginning of my main.scss as below:

@import '_variables.scss';
@import '_base.scss'; // not able to use any variables declared in _variables.css

In main.scss, all the global variables work fine. However, none of the global variables works in _base.scss. VS refuses to compile them and they are marked as Undeclared Variable. Is this a VS compiler issue or I am doing something wrong?

Upvotes: 25

Views: 7524

Answers (1)

Colin Bacon
Colin Bacon

Reputation: 15619

If you add the following to _base.scss and your intellisense should behave.

/// <reference path="_variables.scss" />

I have written a post on this if you need more info Get intellisense in sass/less files in visual-studio

Upvotes: 55

Related Questions