When trying to convert relative image paths to absolute paths, there are numerous queries on stackoverflow addressing this issue. For example, take a look at this thread:
MVC4 StyleBundle not resolving images
This question recommends using new CssRewriteUrlTransform()
like so:
bundles.Add(new StyleBundle("~/Content/css/jquery-ui/bundle")
.Include("~/Content/css/jquery-ui/*.css", new CssRewriteUrlTransform()));
Implementing this solution has worked for me in the past. However, when deploying my website within an application (not at the root level), I encountered a new problem:
The current application URL is:
http://localhost/sample/
But the image URLs appear as:
http://localhost/css/imgs/spirit.png
Ideally, they should be:
http://localhost/sample/css/imgs/spirit.png
Interestingly, the bundled CSS link itself is correct and functioning properly.