Im using scss in an angular project. When i use background image like this:
url("/assets/images/test.jpg")
My project builds with no problem and i can see the images on my local or even using ng serve --build
, but when i upload this to my IIS server, all the background images show a 404 error, because the project is looking for the image in domain/assets/image/test.jpg
and not in domain/application/assets/image/test.jpg
.
If i change the image url to assets/images/test.jpg
using chrome Devtools, it works perfectly.
But when i try to change the code to assets
without the "/" at the start i get the following error in the postcss loader:
Can't resolve 'assets/images/test.jpg' in 'D:\application\src\assets'
Tried with "../" "./" "src/assets" and many others, but the application only compiles when a "/" is written at the start.
Im using basehref to build and rewrite rule on my server but still have the same error.