Use the webpack hash for automated cache busting
This commit is contained in:
parent
f88225fe3e
commit
3947d27cf2
|
|
@ -1,15 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html{% if(o.htmlWebpackPlugin.assets.manifest) { %} manifest="{%= o.htmlWebpackPlugin.assets.manifest %}"{% } %}>
|
||||
<html{% if(o.htmlWebpackPlugin.assets.manifest) { %} manifest="{%= o.htmlWebpackPlugin.assets.manifest + '?' + o.hash %}"{% } %}>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{%=o.htmlWebpackPlugin.options.title || 'Webpack App'%}</title>
|
||||
{% for (var css in o.htmlWebpackPlugin.assets.css) { %}
|
||||
<link href="{%=o.htmlWebpackPlugin.assets.css[css]%}" rel="stylesheet">
|
||||
<link href="{%=o.htmlWebpackPlugin.assets.css[css] + '?' + o.hash %}" rel="stylesheet">
|
||||
{% } %}
|
||||
</head>
|
||||
<body>
|
||||
{% for (var chunk in o.htmlWebpackPlugin.assets.chunks) { %}
|
||||
<script src="{%=o.htmlWebpackPlugin.assets.chunks[chunk].entry%}"></script>
|
||||
<script src="{%=o.htmlWebpackPlugin.assets.chunks[chunk].entry + '?' + o.hash %}"></script>
|
||||
{% } %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
1
index.js
1
index.js
|
|
@ -12,6 +12,7 @@ HtmlWebpackPlugin.prototype.apply = function(compiler) {
|
|||
var webpackStatsJson = compilation.getStats().toJson();
|
||||
var templateParams = {};
|
||||
templateParams.webpack = webpackStatsJson;
|
||||
templateParams.hash = webpackStatsJson.hash;
|
||||
templateParams.htmlWebpackPlugin = {};
|
||||
templateParams.htmlWebpackPlugin.assets = self.htmlWebpackPluginAssets(compilation, webpackStatsJson);
|
||||
templateParams.htmlWebpackPlugin.options = self.options;
|
||||
|
|
|
|||
Loading…
Reference in New Issue