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