After some googling on the theme, it appears that the CssRewriteUrlTransform
class makes sure that the image urls work from the dynamic bundle css file, like this:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/mainstyle.css",
"~/Content/bootstrap.css",
"~/Content/site.css")
.Include("~/Content/layout/style.css", new CssRewriteUrlTransform()));
If this does not help, but you however would like using bundling, divide your bundling in parts per folder. Put the folder path in the bundle "name", like this new StyleBundle("~[folder_path]/[any word, like 'css' ot whatever you like]")
:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/mainstyle.css",
"~/Content/bootstrap.css",
"~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/layout/css").Include(
"~/Content/layout/style.css"));