KarimS
KarimS

Reputation: 3892

compiling component scss files angular

so i wanted to use scss for my angular 4 project, i configured it with angular-cli config file, and everything is working, except one thing:

in my main style.scss file i import bootstrap variables file

@import './assets/styles/bootstrap/_variables.scss';
@import './assets/styles/bootstrap/bootstrap.scss';

@import "./assets/styles/datepicker.scss";
@import "./assets/styles/select2.scss";

i have a variable $gray-me defined in __variables.scss file.

when i want to use this variable in the style.scss file, it work as excpected, but when i want to use it in a compoenent scss file, it give me this errorr

Undefined variable: "$gray-me"

its like the component scss and global style.scss where compiled separatly.

so is there is a way to fix that and make them compile in one piece.

Upvotes: 0

Views: 601

Answers (1)

Sam Herrmann
Sam Herrmann

Reputation: 6976

Make sure you @import all required .scss files in your component.scss. The component.scss files are not global and therefore need to explicitly import all required references, i.e. @import "__variables".

Upvotes: 1

Related Questions