nlyk nlyk - 10 months ago 111
Sass (Sass) Question

use of $primary scss variable in angular/material2

I'm using angular-cli and the theming guide in order to created a custom theme in a angular/material2 application.

In the scss file the primary and accent colors are assigned to the $primary and $accent scss variables accordingly.

Is there any way to use the $primary variable in a custom component scss style?
Any atempt results: 'Undefined variable: "$primary"' when angular-cli tries to compile the component's stylesheet.

Thank you in advance

Answer Source

You may have to use an import statement in the file you are trying to change or use the $primary variable. I am using the scss from a front-end framework, and have to do this in my main.scss file:

@import "frontEndFramework.scss";