Don't inject a hash by default
This commit is contained in:
parent
383dcd480f
commit
932d295d1c
6
index.js
6
index.js
|
|
@ -149,11 +149,11 @@ HtmlWebpackPlugin.prototype.injectAssetsIntoHtml = function(html, templateParams
|
|||
});
|
||||
// Turn script files into script tags
|
||||
scripts = scripts.map(function(scriptPath) {
|
||||
return '<script src="' + scriptPath + '?' + templateParams.hash + '"></script>';
|
||||
return '<script src="' + scriptPath + templateParams.htmlWebpackPlugin.querystring + '"></script>';
|
||||
});
|
||||
// Turn css files into link tags
|
||||
styles = styles.map(function(stylePath) {
|
||||
return '<link href="' + stylePath + '?' + templateParams.hash + '" rel="stylesheet">';
|
||||
return '<link href="' + stylePath + templateParams.htmlWebpackPlugin.querystring + '" rel="stylesheet">';
|
||||
});
|
||||
// Append scripts to body element
|
||||
html = html.replace(/(<\/body>)/i, function (match) {
|
||||
|
|
@ -170,7 +170,7 @@ HtmlWebpackPlugin.prototype.injectAssetsIntoHtml = function(html, templateParams
|
|||
if (match.test(/\smanifest\s*=/)) {
|
||||
return match;
|
||||
}
|
||||
return start + ' manifest="' + assets.manifest + '?' + templateParams.hash + '"' + end;
|
||||
return start + ' manifest="' + assets.manifest + templateParams.htmlWebpackPlugin.querystring + '"' + end;
|
||||
});
|
||||
}
|
||||
return html;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ describe('HtmlWebpackPlugin', function() {
|
|||
inject: true,
|
||||
template: path.join(__dirname, 'fixtures/plain.html')
|
||||
})]
|
||||
}, ['<script src="util_bundle.js?%hash%"', '<script src="app_bundle.js?%hash%"'], null, done);
|
||||
}, ['<script src="util_bundle.js"', '<script src="app_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to inject the assets into a html string', function (done) {
|
||||
|
|
@ -116,7 +116,7 @@ describe('HtmlWebpackPlugin', function() {
|
|||
inject: ['util', 'app'],
|
||||
templateContent: fs.readFileSync(path.join(__dirname, 'fixtures/plain.html'), 'utf8')
|
||||
})]
|
||||
}, ['<script src="util_bundle.js?%hash%"', '<script src="app_bundle.js?%hash%"'], null, done);
|
||||
}, ['<script src="util_bundle.js"', '<script src="app_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to inject a specified asset into a given html file', function (done) {
|
||||
|
|
@ -133,7 +133,7 @@ describe('HtmlWebpackPlugin', function() {
|
|||
inject: ['app'],
|
||||
template: path.join(__dirname, 'fixtures/plain.html')
|
||||
})]
|
||||
}, ['<script src="app_bundle.js?%hash%"'], null, done);
|
||||
}, ['<script src="app_bundle.js"'], null, done);
|
||||
});
|
||||
|
||||
it('allows you to use the deprecated assets object', function (done) {
|
||||
|
|
@ -232,6 +232,17 @@ describe('HtmlWebpackPlugin', function() {
|
|||
}, ['<script src="index_bundle.js?%hash%"'], null, done);
|
||||
});
|
||||
|
||||
it('allows to append hashes to the assets', function(done) {
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/index.js'),
|
||||
output: {
|
||||
path: OUTPUT_DIR,
|
||||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin({hash: true, inject: true})]
|
||||
}, ['<script src="index_bundle.js?%hash%"'], null, done);
|
||||
});
|
||||
|
||||
it('prepends the webpack public path to script src', function(done) {
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/index.js'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue