Compare commits

...

3 Commits

Author SHA1 Message Date
Jan Nicklas 0a1f3a4464 Release 1.6.2 2015-10-08 21:59:10 +02:00
Jan Nicklas b8b7586717 Merge pull request #92 from thomasguillory/fix/publicPath-hash
FIX missing [hash] interpolation in publicPath
2015-10-04 16:34:38 +02:00
Thomas Guillory 41a255a2f1 FIX missing [hash] interpolation in publicPath
Webpack gives the possibility to use the build [hash] in
output.publicPath option:
https://webpack.github.io/docs/long-term-caching.html

However HtmlWebpackPlugin is reading directly the raw option, preventing the
user to use this option when using it.
2015-10-02 16:13:59 +02:00
3 changed files with 14 additions and 2 deletions
+1 -1
View File
@@ -175,7 +175,7 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function(compilation, webp
// Use the configured public path or build a relative path
var publicPath = typeof compilation.options.output.publicPath !== 'undefined' ?
compilation.options.output.publicPath :
compilation.mainTemplate.getPublicPath({hash: webpackStatsJson.hash}) :
path.relative(path.dirname(self.options.filename), '.');
if (publicPath.length && publicPath.substr(-1, 1) !== '/') {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "html-webpack-plugin",
"version": "1.6.1",
"version": "1.6.2",
"description": "Simplifies creation of HTML files to serve your webpack bundles",
"main": "index.js",
"files": [
+12
View File
@@ -304,6 +304,18 @@ describe('HtmlWebpackPlugin', function() {
}, [/<script src="index_bundle_[0-9a-f]+\.js/], null, done);
});
it('handles hashes in publicPath', function(done) {
testHtmlPlugin({
entry: path.join(__dirname, 'fixtures/index.js'),
output: {
path: OUTPUT_DIR,
filename: 'index_bundle.js',
publicPath: 'assets/[hash]/'
},
plugins: [new HtmlWebpackPlugin()]
}, [/<script src="assets\/[0-9a-f]+\/index_bundle\.js/], null, done);
});
it('allows to append hashes to the assets', function(done) {
testHtmlPlugin({
entry: path.join(__dirname, 'fixtures/index.js'),