This project has moved and is read-only. For the latest updates, please go here.

Using with CssRewriteUrlTransform

Aug 27, 2013 at 8:24 PM
I'm attempting to use the LESS extension with Bootstrap, which contains several url() references for images, etc. I cannot figure out how to get the CssTransformer to use the CssRewriteUrlTransform to rewrite these when I am only including the top-level less file.

Any ideas?
var defaultCssBundle = new Bundle("~/Content/All.css", new CssTransformer());
defaultCssBundle.Include("~/Content/bootstrap/bootstrap.less", new CssRewriteUrlTransform());
Aug 28, 2013 at 7:48 AM
You do not need CssRewriteUrlTransform.

Bundle Transformer itself resolves the relative paths in the CSS-files.
Aug 28, 2013 at 10:38 PM
Hmm... I will have to test, as I swear it wasn't doing that for me once debug was false...
Aug 29, 2013 at 11:37 AM
Try without CssRewriteUrlTransform. Everything should work correctly.

BundleTransformer.Less, BundleTransformer.LessLite and BundleTransformer.SassAndScss correctly handle relative paths, even if you use the @import Directive. Relative paths in static CSS-files resolves a BundleTransformer.Core.

May you have not installed BundleTransformer.Less or BundleTransformer.LessLite?
Sep 11, 2013 at 9:22 AM
Will BundleTransformer be rewritten to use CssRewriteUrlTransform from Web.Optimization natively?
Sep 12, 2013 at 10:23 AM
Hello, Nettsentrisk!

In BundleTransformer.Less, BundleTransformer.SassAndScss and BundleTransformer.TypeScript 1.8.3 fixed an error that occurred when using the item transformations (classes that implements an IItemTransform interface).

But still don't recommend using CssRewriteUrlTransform.