Answers for "include scss variables in angular export component"

CSS
0

import global variables scss angular

/*in the src/_variables file:*/
$primary-color: blue;

/*in the component you want to use the variable:*/

@use 'src/variables' as c;

.container-fluid {
  text-align: center;
  background-color: c.$primary-color;
}
Posted by: Guest on April-24-2021
-1

how to import scss file in angular

In the new angular v6, importing sass files is a little different from the previous version.

I just needed to import like this (in a component stylesheet)

@import "~src/sass/variables";    // note: without file extension

Now everything works fine

Thanks all for the help
Posted by: Guest on March-09-2021

Browse Popular Code Answers by Language