I have a running Angular 7 application and I am trying to create custom control library.I have some global styles that needs to be imported into the Angular application from this control library.
I am trying to achieve something like the following:
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
in the consumer application where this control library will be used. I have a root style sheet which imports other mixins as shown below:
root.scss
@include list-themeable($theme);
@include radiobutton-themeable($theme);
@include checkbox-themeable($theme);
I need to compile this root.scss file during the library build to create a css file that could be imported in the consumer application where this library will be used.
I googled for the solution and came across Compiling css library in Angular 6:
Install some devDependencies in our library in order to bundle the css:
ng-packagr scss-bundle ts-node
Create a css-bundle.ts
Add _theme.scss inside the /src directory of the library that actually contains and imports all the css that we want to bundle.
Add postbuild npm script to run the css-bundle.ts:
Include it in the styles tag in your Application in the angular.json
Is there any other way to do it..?
Please help me on this.