Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CssRewriteUrlTransform does not take

bundles.Add(new StyleBundle("~/a/b/c")
    .Include("~/Content/font-awesome.css", new CssRewriteUrlTransform()));

I have this bundling. The font-awesome css has a url defined as url('../fonts/fontawesome-webfont.eot?v=4.0.3') which is valid when the css is located under "~/Content/font-awesome.css" but now its located under "~/a/b"

But CssRewriteUrlTransform does not kick in and rewrite path to url('../../fonts/fontawesome-webfont.eot?v=4.0.3')

Update: If I remove the .min file it CssRewriteUrlTransformstarts to work, bug in web optimization?

https://aspnetoptimization.codeplex.com/workitem/166

like image 474
Anders Avatar asked Oct 20 '22 11:10

Anders


1 Answers

Had the same problem with me.

You need to set the Bundle url relative to the folder of your file.

bundles.Add(new StyleBundle("~/Content/fontawesomebundle")
    .Include("~/Content/font-awesome.css", new CssRewriteUrlTransform()));

Update: It appears that CssRewriteUrlTransform doesn't work for min file. Either use .min file in the include or remove the min file.

like image 123
Ruchan Avatar answered Oct 21 '22 23:10

Ruchan