CssRewriteUrlTransform does not take

℡╲_俬逩灬. 提交于 2020-05-11 07:45:49

问题


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


回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!