I'm presently 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 core, 1.7.0-Beta1 for LESS) which is used to convert LESS into CSS. Based on web searches
paths within CSS (and less) appear to be a common issue, in most cases it is recommended to manually modify the CSS and be done with it. However, due to differences between our development and production environment, and not owning the affected CSS such a
solution is not feasible.
Two solutions seem to exist. The first is to overlay the virtual directory as defined by the bundling over the actual directory that contains the content. To me this seems like a poor option.
Secondly, and the route I've chosen, is to use a IItemTransform such as CssRewriteUrlTransform (mentioned in
this stackoverflow post
. Even this solution has it's
. As such I've attempted to write my own ItemTransformer but it seems that the results of it's execution is ignored when used in the following manner:
public static void RegisterBundles(BundleCollection bundles)
/* among other work pass in IItemTransformer to fix paths */
var styleBundle = new StyleBundle("~/bundles/css/styles")
.Include("~/Content/less/font-awesome.less", new RewriteUrlTransform())
styleBundle.Orderer = new NullOrderer();
Implementation of IItemTransform:
public class RewriteUrlTransform : IItemTransform
public string Process(string includedVirtualPath, string input)
return (input manipulated with proper path replacing bad path)
Unless I'm entirely misunderstanding how an IItemTransform is to be used, which is quite possible due to lack of documentation, I would think that the return of the Process method is the new post processed CSS. However, the return seems to be ignored. The original
input is always in use, even when I return a String.Empty(). Am I doing something wrong here or is it indeed a bug?
( this is a cross post with stack overflow