国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

angular2.0 筆記 - 02

tain335 / 2074人閱讀

摘要:此屬性包含了本項目中所有的子項目的配置信息。稍后多帶帶拿這個屬性詳細講解其注意點。

angular2.0 筆記 1.angular-cli 之 angular.json 配置表參數說明

簡單創建一個demo項目

ng new project-demo
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "project-demo": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {},
        "serve": {},
        "extract-i18n": {},
        "test": {},
        "lint": {}
      }
    },
    "project-name-test": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {},
        "serve": {},
        "extract-i18n": {},
        "test": {},
        "lint": {}
      }
    }
  },
  "defaultProject": "project-demo"
}
上面的json是一個刪除了部分內容的angular.json僅用于講解使用,后面會給出完整json
參數 作用
$schema 關聯了JSON Schema在angular CLI 的執行config.json文件
version 項目版本
newProjectRoot 這個屬性定義了CLI創建的新的內部應用和庫放置的位置,默認值為"projects"
projects 這個屬性,個人覺得有必要認真講一下。此屬性包含了本項目中所有的子項目的配置信息。稍后多帶帶拿這個屬性詳細講解其注意點。
defaultProject 屬性表示該項目的名字
2.projects 下一級屬性名 是子項目的名稱

子項目名稱的作用,可以用于ng 命令執行
比如上面的json有一個子項目名字 project-name-test

如果想多帶帶運行某個子項目時,可以執行
ng serve project-name-test

如果子項目不在projects內,執行 ng serve [project-name] 就會包一個錯
The serve command requires to be run in an Angular project, but a project definition could not be found.

創建一個子項目,可以執行
ng generate application project-name

而且,每創建一個子項目,都會有一個[project-name]-e2e的子項目在projects里面

3.projects 子項目 里面的 屬性 說明
屬性 作用
root 指定了子項目文件的根文件夾,可能是空值
sourceRoot 子項目源文件目錄位置
projectType 子項目類型, applicationlibrary
prefix 創建子項目時,用這個屬性來區分當前子項目是 componentdirectivelib,或其他,當cli創建時會確定
schematics Schematics packages 配置(本人暫時還不知道其具體作用)
architect 此屬性包含了項目的一些命令,比如 build/serve/test/lint 或者自定義命令 extract-i18n
以上部分屬性內容參考自Alfred的 angular.json參數詳解
項目例子 json
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "project-demo": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/project-demo",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css"
            ],
            "scripts": [],
            "es5BrowserSupport": true
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "project-demo:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "project-demo:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "project-demo:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "styles": [
              "src/styles.css"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "project-demo-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "prefix": "",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "project-demo:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "project-demo:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "project-demo-two": {
      "root": "projects/project-demo-two/",
      "sourceRoot": "projects/project-demo-two/src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/project-demo-two",
            "index": "projects/project-demo-two/src/index.html",
            "main": "projects/project-demo-two/src/main.ts",
            "polyfills": "projects/project-demo-two/src/polyfills.ts",
            "tsConfig": "projects/project-demo-two/tsconfig.app.json",
            "assets": [
              "projects/project-demo-two/src/favicon.ico",
              "projects/project-demo-two/src/assets"
            ],
            "styles": [
              "projects/project-demo-two/src/styles.css"
            ],
            "scripts": [],
            "es5BrowserSupport": true
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "projects/project-demo-two/src/environments/environment.ts",
                  "with": "projects/project-demo-two/src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "project-demo-two:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "project-demo-two:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "project-demo-two:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "projects/project-demo-two/src/test.ts",
            "polyfills": "projects/project-demo-two/src/polyfills.ts",
            "tsConfig": "projects/project-demo-two/tsconfig.spec.json",
            "karmaConfig": "projects/project-demo-two/karma.conf.js",
            "styles": [
              "projects/project-demo-two/src/styles.css"
            ],
            "scripts": [],
            "assets": [
              "projects/project-demo-two/src/favicon.ico",
              "projects/project-demo-two/src/assets"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "projects/project-demo-two/tsconfig.app.json",
              "projects/project-demo-two/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "project-demo-two-e2e": {
      "root": "projects/project-demo-two-e2e/",
      "projectType": "application",
      "prefix": "",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "projects/project-demo-two-e2e/protractor.conf.js",
            "devServerTarget": "project-demo-two:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "project-demo-two:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "projects/project-demo-two-e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "project-demo"
}

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://m.specialneedsforspecialkids.com/yun/103355.html

相關文章

  • angular2.0 筆記 - 01

    angular2.0 學習筆記 ### 1.angular-cli 常用命令記錄 詳細教程 angular cli官網 有,這里不詳細說明,感興趣的可以自行到官網看,一下僅記錄本人到學習過程常用到的命令 1.創建項目 ng new ng new project-name exp: ng new my-app 2.啟動項目 ng serve 參數名 類型 默認值 作用 exp ...

    AnthonyHan 評論0 收藏0
  • GridManager 開源歷程

    摘要:歷程啟動于年月日不曾想這一堅持已經多天了。每個午飯后晚飯前。期間對的認知與實踐提升明顯,并沉淀下名為的類庫。每次發布前的,成為一種風險把控。在此之前從沒有如此的認同單元測試,也相信這終將會成為一種大家都遵守的契約。 GridManager歷程 GridManager 啟動于2015年02月10日, 不曾想這一堅持已經1200多天了。總想為此記錄些什么,但一直未曾動手。午飯后,公司很安靜...

    honhon 評論0 收藏0
  • 2017年2月份前端資源分享

    平日學習接觸過的網站積累,以每月的形式發布。2017年以前看這個網址:http://www.kancloud.cn/jsfron... 1. Javascript 前端生成好看的二維碼 十大經典排序算法(帶動圖演示) 為什么知乎前端圈普遍認為H5游戲和H5展示的JSer 個人整理和封裝的YU.js庫|中文詳細注釋|供新手學習使用 擴展JavaScript語法記錄 - 掉坑初期工具 漢字拼音轉換...

    lily_wang 評論0 收藏0
  • 2017年2月份前端資源分享

    平日學習接觸過的網站積累,以每月的形式發布。2017年以前看這個網址:http://www.kancloud.cn/jsfron... 1. Javascript 前端生成好看的二維碼 十大經典排序算法(帶動圖演示) 為什么知乎前端圈普遍認為H5游戲和H5展示的JSer 個人整理和封裝的YU.js庫|中文詳細注釋|供新手學習使用 擴展JavaScript語法記錄 - 掉坑初期工具 漢字拼音轉換...

    chengjianhua 評論0 收藏0
  • 2017年2月份前端資源分享

    平日學習接觸過的網站積累,以每月的形式發布。2017年以前看這個網址:http://www.kancloud.cn/jsfron... 1. Javascript 前端生成好看的二維碼 十大經典排序算法(帶動圖演示) 為什么知乎前端圈普遍認為H5游戲和H5展示的JSer 個人整理和封裝的YU.js庫|中文詳細注釋|供新手學習使用 擴展JavaScript語法記錄 - 掉坑初期工具 漢字拼音轉換...

    Anonymous1 評論0 收藏0

發表評論

0條評論

最新活動
閱讀需要支付1元查看
<