Where is the file angular-cli.json in the new @angular/cli version?

后端 未结 3 1589
再見小時候
再見小時候 2020-12-30 19:35

I\'m new in angular2 and i have tried to create a project with cli, but when I try to change the css adding it in angular-cli.json, I have detected that this file is not cre

3条回答
  •  离开以前
    2020-12-30 20:02

    The angular-cli.json should be located in the root folder of the project. This is using the latest version "@angular/cli": "1.0.0-beta.32.3".

    As for creating it if it is missing or maybe accidentally deleted, you could try that since the original version is pretty generic. Here is what it should look like right after project creation:

    {
      "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
      "project": {
        "version": "1.0.0-beta.32.3",
        "name": "testproj"
      },
      "apps": [
        {
          "root": "src",
          "outDir": "dist",
          "assets": [
            "assets",
            "favicon.ico"
          ],
          "index": "index.html",
          "main": "main.ts",
          "polyfills": "polyfills.ts",
          "test": "test.ts",
          "tsconfig": "tsconfig.json",
          "prefix": "app",
          "styles": [
            "styles.css"
          ],
          "scripts": [],
          "environmentSource": "environments/environment.ts",
          "environments": {
            "dev": "environments/environment.ts",
            "prod": "environments/environment.prod.ts"
          }
        }
      ],
      "e2e": {
        "protractor": {
          "config": "./protractor.conf.js"
        }
      },
      "lint": [
        {
          "files": "src/**/*.ts",
          "project": "src/tsconfig.json"
        },
        {
          "files": "e2e/**/*.ts",
          "project": "e2e/tsconfig.json"
        }
      ],
      "test": {
        "karma": {
          "config": "./karma.conf.js"
        }
      },
      "defaults": {
        "styleExt": "css",
        "component": {}
      }
    }
    

    You could also try generating a new project with the cli with ng new PROJECT_NAME and see if it contains the angular-cli.json file.

提交回复
热议问题