title: ASP.NET MVC: StyleBundle IncludeDirectory & CssRewriteUrlTransform
body: <p>I have the same problem as many that my images are not resolved when I bundle my CSS-Stylesheets.</p>
  
  <p>Now I found some SO-Answers that suggest using <code>new CssRewriteUrlTransform()</code> as second parameter for the "Include"-Method of a new StyleBundle-Object. <a href="https://stackoverflow.com/questions/27277614/asp-net-mvc-cssrewriteurltransform-multiple-arguments">This one for example</a></p>
  
  <p>I'm using IncludeDirectory because I have a directory where I can add files without having them to register somewhere (and they are many files which I don't want to list). But IncludeDirectory doesn't have an override to pass a CssRewriteUrlTransform-Object:</p>
  
  <p><strong>Doesn't work:</strong> <code>bundles.Add(new StyleBundle("~/bundles/css/directives").IncludeDirectory("~/app/directives", "*.css", true));</code></p>
  
  <p><strong>I also tried:</strong> </p>
  
  <pre><code>StyleBundle sb = new StyleBundle();
  sb.Transforms.Add(new CssRewriteUrlTransform());
  </code></pre>
  
  <p>But Transforms are of Type IBundleTransform and I'm trying to pass an IItemTransform.</p>
  
  <p>Any suggestions on how to do this?</p>