omegascorp
omegascorp

Reputation: 141

Angular 6 multiple css files in the dist

I'm working on the SAAS product with the client customization. Basically, we keep one SCSS entry point for generic styling and want to keep an additional entry point per brand. The problem is when I define an array in the angular.json it compiles all into the single css file. I want to have a file with generic css and a css file per client. Is it possible to do with angular-cli?

Upvotes: 5

Views: 4845

Answers (2)

Sam Andreatta
Sam Andreatta

Reputation: 193

Update 2020: use option "inject: false" if you want to tell the Angular CLI to NOT include the styles right away if you want to include them later. Older versions of Angular use "lazy" instead of inject.

 "styles": [
    "src/styles.scss",
        {
          "input": "src/styles/themes/dark.scss",
           "bundleName": "dark",                
           "lazy": false
        }
    ]

Upvotes: 4

omegascorp
omegascorp

Reputation: 141

Basically, I found the answer myself. It's possible to use the following syntax in the angular.json:

"styles": [
    "src/styles.css",
    { "input": "src/pre-rename-style.scss", "bundleName": "renamed-style" }
],

Here is the link to documentation: https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/global-styles.md

Upvotes: 9

Related Questions