font-awesome not working bundleconfig in MVC5

前端 未结 6 460
挽巷
挽巷 2020-12-04 13:00

If I direct refer to font-awesome.css in _layouts page. it will work



        
6条回答
  •  半阙折子戏
    2020-12-04 13:36

    Try using CssRewriteUrlTransform when bundling:

    bundles.Add(new StyleBundle("~/Content/css").Include(
            "~/Content/bootstrap.css",                        
            "~/Content/body.css",
            "~/Content/site.css",
            "~/Content/form.css"
        ).Include("~/Content/font-awesome-4.0.3/css/font-awesome.css", new CssRewriteUrlTransform());
    

    This changes any urls for assets from within the css file to absolute urls so the bundling doesn't mess up the relative path.

    Docs for CssRewriteUrlTransform

提交回复
热议问题