my angular app ends up being deployed to web server with different virtual paths such as:
http://website.com/app1/
http://website.com/app2/
To get them both work properly, at the build stage I change angular's <base href=>
and webpack's publicUrl
options to match specific virtual path app1
or app2
.
The urls in my index.html
are properly changed from
<img src='hello.png'/>
to <img src='app1/hello.png'/>
but the urls inside the css and sass are not changed at all.
I use style-loader
, css-loader
and sass-loader
plugins like that:
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
include: [helpers.root('src', 'styles')],
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
include: [helpers.root('src', 'styles')]
}
And lets say my css is:
body {
background-image: url(bg.png);
}
Can I force webpack to add publicUrl
to bg.png
and load it from url(app1/bg.png)
?
UPD: There is no way to use Angular CLI