How do I add Sass compilation in Angular CLI 6: angular.json?

前端 未结 3 633
再見小時候
再見小時候 2021-01-30 02:02

I just created a new Angular project using the new Angular CLI 6.0, but I need to add Sass compilation to my project. I\'m aware you can set a flag when you create a project, bu

3条回答
  •  执笔经年
    2021-01-30 02:33

    Doing exactly what Smokey Dawson commented,

    "projects": {
      "angular-app": {
        "root": "",
        "sourceRoot": "src",
        "projectType": "application",
        "prefix": "app",
        "schematics": {
          "@schematics/angular:component": {
            "styleext": "scss"
          }
        },
        "architect": {...}
      }
    }
    

    The above is the result. So in your app, under the key schematics, add a key @schematics/angular:component with the key styleext set to scss.

    This should be applied to your angular.json file in the root directory of your project.

提交回复
热议问题