html-webpack-plugin插件

  功能:自动生成html模板

  var  HtmlWebpackPlugin = require('html-webpack-plugin') 

  module.exports = {

    ...,

    plugins: [

      new HtmlWebpackPlugin({

       filename: config.build.index   //配置的html文件目录是相对于output.path路径

       template: 'index.html' //本地模板文件的位置

       inject: true   //注入所有静态资源

       minify: {

         removeComments: true,  //删除注释

         collapseWhitespace: true,  //删除空格

         removeAttributeQuotes: true //删除引用

 

       }

      })

    ]

  }  

  资料: https://www.cnblogs.com/wonyun/p/6030090.html    

      https://github.com/ampedandwired/html-webpack-plugin
 
      https://github.com/kangax/html-minifier#options-quick-reference

 

posted @ 2017-11-13 22:57  少华ShaoHua  阅读(212)  评论(0编辑  收藏  举报