Angular CLI終極參考指南-運行

運行項目

想在瀏覽器中查看項目,能夠跳轉到相應目錄css

$ cd my-app

運行html

$ ng serve

在爲4200端口上啓動開發服務webpack

** NG Live Development Server is running on http://localhost:4200. **
3935ms building modules
Hash: fd7ad6cf3503757e22e0
Version: webpack 2.1.0-beta.25
Time: 6526ms
            Asset       Size  Chunks             Chunk Names
   main.bundle.js    2.78 MB    0, 2  [emitted]  main
 styles.bundle.js    10.2 kB    1, 2  [emitted]  styles
        inline.js    5.53 kB       2  [emitted]  inline
         main.map    2.86 MB    0, 2  [emitted]  main
       styles.map    14.1 kB    1, 2  [emitted]  styles
       inline.map    5.59 kB       2  [emitted]  inline
       index.html  472 bytes          [emitted]
assets/.npmignore    0 bytes          [emitted]
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  2.81 kB       0
webpack: bundle is now VALID.

如今你能夠在瀏覽器上輸入http://localhost:4200/ 來訪問你的項目
首頁
啓動過程當中作了這些事情:git

  1. Angular CLI從angular-cli.json加載依賴
  2. Angular CLI運行webpack來構建全部js與css代碼
  3. Angular CLI啓動webpack dev server 在localhost:4200上瀏覽頁面

注意:在執行完第三步之後,ng serve命令不會退出,並輸出執行狀況
與此同時,因爲該進程有LiveReload的支持,TA會動態監聽src目錄下文件的更改,當發現有文件更新,從新運行第二步,並自動刷新瀏覽器
要中止此進程返回命令行,能夠輸入ctrl+cgithub

相關文章
相關標籤/搜索