wandergis / avalon-webpack-spa

一个集成了avalon mmstate oniui jquery webpack gulp的工程化项目
http://wandergis.github.io/avalon-webpack-spa/
MIT License
59 stars 15 forks source link

静态资源hash化 #1

Open sundyxfan opened 8 years ago

sundyxfan commented 8 years ago

html页面

 <link rel="stylesheet" type="text/css" href="./demo.css">
 <script type="text/javascript" src=".demo.js"></script>           
<img src="../demo.png">

这些静态资源在html 直接引入,经webpack打包后,如何添加hash?

wandergis commented 8 years ago

使用html-webpack-plugin $ npm install html-webpack-plugin --save-dev 设置里面设置hash为true即可

new HtmlWebpackPlugin({
      template: 'tpl.html',
      hash: true
    })

详细文档请看这里

sundyxfan commented 8 years ago

不行

wandergis commented 8 years ago

或者你通过修改模板来实现吧 这块css和js加hash直接配置就可以