Reputation: 503
I have a webpack config that processes many .styl (Stylus) files and within those stylesheets I have many url('..path/to/asset.svg') that I'd like to change to output as url('images/asset.svg') regardless of the intial path specified.
Is this possible with webpack or webpack plugin, I've had a look but I can't find anything that fits the bill.
Here is my current config (relevant section):
module : {
loaders : [{
test : /\.styl?/,
exclude: /node_modules/,
include: STYLE_DIR,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader','stylus-loader']
})
}
Your input is appreciated, thank you!
Upvotes: 0
Views: 829
Reputation: 1102
Although it doesn't take care of itself no matter what the path, you could add aliases for the paths you want to switch through css-loader: https://github.com/webpack-contrib/css-loader#alias
use: [
{
loader: "css-loader",
options: {
alias: {
"../path/to/asset": "images",
"other/path/place": "images"
}
}
},
{
loader: "stylus-loader"
}
]
Upvotes: 2