Home > OS >  How do I tell Angular 14 CLI to create SCSS Files?
How do I tell Angular 14 CLI to create SCSS Files?

Time:08-12

This is harder than it should be, but my option to create SCSS files by default appears to no longer function in Angular 14. Running the ng generate component command is currently producing CSS files, which is undesirable.

Conventional wisdom said to try the command below, but it immediately produces the following error. Similar combinations that used to work in the past also fail.

$ ng config defaults.styleExt scss
Error: Schema validation failed with the following errors:
  Data path "" must NOT have additional properties(defaults).

CodePudding user response:

Make sure you set scss as the default style format in your angular.json file like so:

  "schematics": {
    "@schematics/angular:component": {
      "style": "scss"
    },

Now when you generate a component, a scss file should be created.

  • Related