online demo https://jeromehan.github.io/w...css
基於webpack搭建純靜態頁面型前端工程解決方案模板html
$ git clone https://github.com/jeromehan/webpack-jquery.git
$ cd webpack-jquery前端
$ npm install
. ├── package.json # 項目配置 ├── README.md # 項目說明 ├── src # 源碼目錄 │ ├── index.ejs # 首頁 │ ├── pageA.html # 頁面A │ ├── css/ # css資源 │ ├── img/ # 圖片資源 │ ├── js # js&jsx資源 │ │ ├── index.js # 主頁入口 │ │ ├── pageA.js # 頁面A入口 │ │ ├── lib/ # 沒有存放在npm的第三方庫或者下載存放到本地的基礎庫,如jQuery、Zepto、React等 ├── webpack.config.allinone.js # webpack配置 ├── webpack.config.js # 正式環境webpack配置入口 └── webpack-dev.config.js # 開發環境webpack配置入口
約定/src/*.html爲應用的入口文件,在/src/js/ 一級目錄下需有一個同名的js文件做爲該文件的入口。jquery
$ npm run dev
生產環境會對js混淆壓縮,對css、html進行壓縮,字符替換等處理webpack
$ npm run build