How to include a Sass theme in all Angular Components?

Viewed 865

I want to create a theme with Sass in Angular.

I use Bootstrap architecture of files:

style/
|– main.scss   # Manifest file 
|– _alerts.scss     # Component file 
|– _buttons.scss    # Component file 
|– _mixins.scss     # Mixin file – imports all files from mixins folder
|–  ...             # Etc..
|– mixins/
|  |–  _alerts.scss # Alert mixin
|  |– _buttons.scss # Button mixin
|  |– ...           # Etc..

I want to use some mixin or other classes in the sass of the components, how i can do that?

Is possible to include only one time the manifest file and be included automatically in all components?

I know that is a good practice to keep the style of component atomic but how i can implement a design system if i cannot use a global style?

1 Answers

You can add your main.scss path to the angular.json and thus use your custom SASS theme for all the components.

A example of an angular.json file with some global styles:

enter image description here

Related