简体   繁体   中英

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

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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM