I am currently working on a project that uses the ASP.NET Web Optimization library (v 1.1.0-Beta1) in conjunction with the Bundle Transformer extension (v 1.7.3-Beta1 for the kernel, 1.7.0-Beta1 for LESS), which used to convert LESS to CSS. Based on web search paths in CSS (and less) seems to be a common problem, in most cases it is recommended to manually modify CSS and do with it. However, due to the differences between our development and the production environment and not having affected CSS, such a solution is not possible.
There seem to be two solutions. The first is to overlay the virtual directory, as defined by the link over the actual directory containing the content. To me this seems like a bad option.
Secondly, the route that I chose should use IItemTransform, for example CssRewriteUrlTransform(mentioned in this post . Even this solution has this limitation . Thus, I tried to write my own ItemTransformer, but it seems that the results of its execution are ignored when used in the following way :
public static void RegisterBundles(BundleCollection bundles)
{
var styleBundle = new StyleBundle("~/bundles/css/styles")
.Include(...)
.Include("~/Content/less/font-awesome.less", new RewriteUrlTransform())
.Include(...);
styleBundle.Transforms.Add(new CssTransformer());
styleBundle.Orderer = new NullOrderer();
bundles.Add(styleBundle);
}
IItemTransform implementation:
public class RewriteUrlTransform : IItemTransform
{
public string Process(string includedVirtualPath, string input)
{
return (input manipulated with proper path replacing bad path)
}
}
, IItemTransform, - , , Process - - CSS. , , . , String.Empty(). - ?