Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 6sass global variables

Tags:

css

sass

angular

I defined a variable like this in the global scss called styles.scss in angular6

$color-redpink-dark: #E84A5F;

and I want to use the variable in a scss component, but when I declare the property I have the next output:

  background-color: $color-redpink-dark;               
  Undefined variable: "$color-redpink-dark".

Should not the component scss use the color defined in the global scss?

Greetings.

like image 922
Aceconhielo Avatar asked May 12 '26 20:05

Aceconhielo


1 Answers

You have to import the file with defined variable in the beginning of component.scss file using the variable:

@import 'your-file-name';

background-color: $color-redpink-dark;
like image 58
hohnzy Avatar answered May 14 '26 13:05

hohnzy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!