I know there are other questions, but none have the answer I need.
Just need to be able to force an absolute path in some LESS that's included in an MVC page so that the images (etc) are correctly picked up.
[websiteroot]
----Content
--------img
------------<image files>
--------bootstrap
------------<bootstrap files>
--------site.LESS
--------Site_styles.LESS
----Views
--------Shared
------------_Layout.cshtml
It's not even in a bundle, it's just directly included in _Layout.cshtml as
@Styles.Render("~/Content/Site_styles.less");
In Site_styles.less I have
.carousel-image-1
{
width: 100%;
background: url('img/banner1.jpg') no-repeat;
}
but I can't get it to be absolute, i.e.
"~/Content/img/banner1.jpg"
it is rendered as
background: url('/Content/img/sodexo_banner1.jpg')
In case it matters, other LESS [bootstrap etc] is in a bundle like so
BundleTable.EnableOptimizations = false;
bundles.UseCdn = true;
var cssTransformer = new CssTransformer();
var jsTransformer = new JsTransformer();
var nullOrderer = new NullOrderer();
var cssBundle = new StyleBundle("~/Content/css");
cssBundle.Include("~/Content/Site.less");
cssBundle.Include("~/Content/bootstrap/bootstrap.less");
//cssBundle.Include("~/Content/Site_variables.less");
cssBundle.Transforms.Add(cssTransformer);
cssBundle.Orderer = nullOrderer;
bundles.Add(cssBundle);