Is it possible to create a separate CSS file using angular-cli?

By default, everything is bundled:

  • inline.bundle.js
  • polyfills.bundle.js
  • styles.bundle.js
  • vendor.bundle.js
  • main.bundle.js

Is it possible to have a separate CSS file ?

+6
source share
2 answers

You can do this using the --extract-cssflag ng build. This is the default value in mode --prod. More information here: https://github.com/angular/angular-cli/wiki/build

+6
source

As @Rob correctly pointed out, you can use the flag --extract-css. Unfortunately, this flag cannot be used with ng-servefrom Angular 6+.

css ng build ng-serve angular.json architect → build → options "extractCss": true

+1

Source: https://habr.com/ru/post/1670432/


All Articles