Support relative urls on windows (#205)

This commit is contained in:
Jan Nicklas 2016-02-16 08:05:15 +01:00 committed by Jan Nicklas
parent 453975ee0f
commit 63e4ad6fc7
2 changed files with 22 additions and 1 deletions

View File

@ -380,7 +380,7 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function (compilation, chu
var css = chunkFiles.filter(function (chunkFile) {
// Some chunks may contain content hash in their names, for ex. 'main.css?1e7cac4e4d8b52fd5ccd2541146ef03f'.
// We must proper handle such cases, so we use regexp testing here
return /^.css($|\?)/.test(path.extname(chunkFile));
return /.css($|\?)/.test(chunkFile);
});
assets.chunks[chunkName].css = css;
assets.css = assets.css.concat(css);

View File

@ -356,6 +356,27 @@ describe('HtmlWebpackPlugin', function () {
}, ['<link href="styles.css"'], null, done);
});
it('should work with the css extract plugin on windows and protocol relative urls support (#205)', function (done) {
var ExtractTextPlugin = require('extract-text-webpack-plugin');
testHtmlPlugin({
entry: path.join(__dirname, 'fixtures/theme.js'),
output: {
path: OUTPUT_DIR,
filename: 'index_bundle.js',
publicPath: '//localhost:8080/'
},
module: {
loaders: [
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }
]
},
plugins: [
new HtmlWebpackPlugin(),
new ExtractTextPlugin('styles.css')
]
}, ['<link href="//localhost:8080/styles.css"'], null, done);
});
it('should allow to add cache hashes to with the css assets', function (done) {
var ExtractTextPlugin = require('extract-text-webpack-plugin');
testHtmlPlugin({