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

資訊專欄INFORMATION COLUMN

angular2.0 筆記 - 02

tain335 / 2068人閱讀

摘要:此屬性包含了本項(xiàng)目中所有的子項(xiàng)目的配置信息。稍后多帶帶拿這個屬性詳細(xì)講解其注意點(diǎn)。

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

簡單創(chuàng)建一個demo項(xiàng)目

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是一個刪除了部分內(nèi)容的angular.json僅用于講解使用,后面會給出完整json
參數(shù) 作用
$schema 關(guān)聯(lián)了JSON Schema在angular CLI 的執(zhí)行config.json文件
version 項(xiàng)目版本
newProjectRoot 這個屬性定義了CLI創(chuàng)建的新的內(nèi)部應(yīng)用和庫放置的位置,默認(rèn)值為"projects"
projects 這個屬性,個人覺得有必要認(rèn)真講一下。此屬性包含了本項(xiàng)目中所有的子項(xiàng)目的配置信息。稍后多帶帶拿這個屬性詳細(xì)講解其注意點(diǎn)。
defaultProject 屬性表示該項(xiàng)目的名字
2.projects 下一級屬性名 是子項(xiàng)目的名稱

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

如果想多帶帶運(yùn)行某個子項(xiàng)目時,可以執(zhí)行
ng serve project-name-test

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

創(chuàng)建一個子項(xiàng)目,可以執(zhí)行
ng generate application project-name

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

3.projects 子項(xiàng)目 里面的 屬性 說明
屬性 作用
root 指定了子項(xiàng)目文件的根文件夾,可能是空值
sourceRoot 子項(xiàng)目源文件目錄位置
projectType 子項(xiàng)目類型, applicationlibrary
prefix 創(chuàng)建子項(xiàng)目時,用這個屬性來區(qū)分當(dāng)前子項(xiàng)目是 component、directive、lib,或其他,當(dāng)cli創(chuàng)建時會確定
schematics Schematics packages 配置(本人暫時還不知道其具體作用)
architect 此屬性包含了項(xiàng)目的一些命令,比如 build/serve/test/lint 或者自定義命令 extract-i18n
以上部分屬性內(nèi)容參考自Alfred的 angular.json參數(shù)詳解
項(xiàng)目例子 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"
}

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://specialneedsforspecialkids.com/yun/103355.html

相關(guān)文章

  • angular2.0 筆記 - 01

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

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

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

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

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

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

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

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

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

    Anonymous1 評論0 收藏0

發(fā)表評論

0條評論

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