问题
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 CssRewriteUrlTransform
starts to work, bug in web optimization?
https://aspnetoptimization.codeplex.com/workitem/166
回答1:
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.
来源:https://stackoverflow.com/questions/30434867/cssrewriteurltransform-does-not-take