Skip to content

Commit

Permalink
Fix webpack config url in css
Browse files Browse the repository at this point in the history
  • Loading branch information
maximegris committed Apr 21, 2017
1 parent 0a93ebe commit cea4be5
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,58 +130,58 @@ module.exports = {
],
"test": /\.css$/,
"loaders": ExtractTextPlugin.extract({
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader"
],
"fallback": "style-loader",
"publicPath": ""
})
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader"
],
"fallback": "style-loader",
"publicPath": ""
})
},
{
"include": [
path.join(process.cwd(), "src/styles.scss")
],
"test": /\.scss$|\.sass$/,
"loaders": ExtractTextPlugin.extract({
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"sass-loader"
],
"fallback": "style-loader",
"publicPath": ""
})
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"sass-loader"
],
"fallback": "style-loader",
"publicPath": ""
})
},
{
"include": [
path.join(process.cwd(), "src/styles.scss")
],
"test": /\.less$/,
"loaders": ExtractTextPlugin.extract({
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"less-loader"
],
"fallback": "style-loader",
"publicPath": ""
})
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"less-loader"
],
"fallback": "style-loader",
"publicPath": ""
})
},
{
"include": [
path.join(process.cwd(), "src/styles.scss")
],
"test": /\.styl$/,
"loaders": ExtractTextPlugin.extract({
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"stylus-loader?{\"sourceMap\":false,\"paths\":[]}"
],
"fallback": "style-loader",
"publicPath": ""
})
"use": [
"css-loader?{\"sourceMap\":false,\"importLoaders\":1}",
"postcss-loader",
"stylus-loader?{\"sourceMap\":false,\"paths\":[]}"
],
"fallback": "style-loader",
"publicPath": ""
})
},
{
"test": /\.ts$/,
Expand Down Expand Up @@ -252,24 +252,24 @@ module.exports = {
"options": {
"postcss": [
autoprefixer(),
postcssUrl({"url": (URL) => {
postcssUrl({"url": (obj) => {
// Only convert root relative URLs, which CSS-Loader won't process into require().
if (!URL.startsWith('/') || URL.startsWith('//')) {
return URL;
if (!obj.url.startsWith('/') || obj.url.startsWith('//')) {
return obj.url;
}
if (deployUrl.match(/:\/\//)) {
// If deployUrl contains a scheme, ignore baseHref use deployUrl as is.
return `${deployUrl.replace(/\/$/, '')}${URL}`;
return `${deployUrl.replace(/\/$/, '')}${obj.url}`;
}
else if (baseHref.match(/:\/\//)) {
// If baseHref contains a scheme, include it as is.
return baseHref.replace(/\/$/, '') +
`/${deployUrl}/${URL}`.replace(/\/\/+/g, '/');
`/${deployUrl}/${obj.url}`.replace(/\/\/+/g, '/');
}
else {
// Join together base-href, deploy-url and the original URL.
// Also dedupe multiple slashes into single ones.
return `/${baseHref}/${deployUrl}/${URL}`.replace(/\/\/+/g, '/');
return `/${baseHref}/${deployUrl}/${obj.url}`.replace(/\/\/+/g, '/');
}
}})
],
Expand Down

0 comments on commit cea4be5

Please sign in to comment.