Fonts are not rendered correctly in Release Mode, but is working on Debug Mode in ASP NET Webforms

前端 未结 1 730
栀梦
栀梦 2020-12-04 00:20

We were able to solve the problem regarding the rendering of Fonts during release in VS2013.

The font urls in \"app.css\" and \"style.css

相关标签:
1条回答
  • 2020-12-04 01:07

    We have found a better solution for the font issues.

    The asp.net bundling was the source as to why their was a different result between debug and release mode.

    By default, if compilation is on debug mode, the bundling is turned off while if it is on release mode, it is turned on.

    To fix that issue we have turned off the asp.net bundling while on release mode by adding this lines to BundleConfig.Cs.

    BundleTable.EnableOptimizations = false;

    What asp.net bundling does is it creates a virtual directory for all the css and js files. The problem is that it cannot find the path of the urls (specifically the fonts) inside the css files.

    But another solution we have tried is:

    bundles.Add(new StyleBundle("~/bundles/LayoutCss").Include(
                "~/Content/stylesheets/style.css", new CssRewriteUrlTransform() )
                .Include("~/Content/stylesheets/app.css", new CssRewriteUrlTransform() )
                .Include("~/Content/bower_components/slick/dist/slick.css"));
    
    0 讨论(0)
提交回复
热议问题