如何在ASP.NET MVC 5中启用绑定

问题描述 投票:1回答:1

我在玩一些游戏以防止捆绑文件,现在我被困在如何将它们归还捆绑在一起。

我尝试设置debug=false,也将BundleOptimization设置为true,并且文件分开。

我的BundleCOnfig.cs看起来像:

public class BundleConfig
{
    // For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
    public static void RegisterBundles(BundleCollection bundles)
    {
        BundleTable.EnableOptimizations = true;
        #region Styles bundles

        var bundlesCSS = new StyleBundle("~/bundles/css")
            .Include("~/Content/css/libs/bootstrap/bootstrap.css")
            //.Include("~/Content/css/libs/fontawesome/font-awesome.css")
            .Include("~/Content/css/libs/camera/camera.css")
            .Include("~/Content/css/libs/fontawesome/font-awesome.css", new CssRewriteUrlTransformWrapper());

        var bundlesCustom = new StyleBundle("~/bundles/css/custom")
            .Include("~/Content/css/custom/general.css")

        bundlesCSS.Orderer = new AsIsBundleOrderer();
        bundlesCustom.Orderer = new AsIsBundleOrderer();
        bundles.Add(bundlesCSS);
        bundles.Add(bundlesCustom);

        bundles.Add(new StyleBundle("~/bundles/hotel-datepicker-css").Include(
            "~/Content/css/libs/baguetteBox.min.css",
            "~/Content/css/hotel-datepicker/hotel-datepicker.css"
            ));

        #endregion
    }
}

和我的web.config看起来像这样:

<?xml version="1.0"?>
<system.web>
    <compilation debug="false" targetFramework="4.7.2"/>
    <httpRuntime targetFramework="4.7.2"/>
    <httpModules>
        <add name="TelemetryCorrelationHttpModule" 
             type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation"/>
    </httpModules>
</system.web>
asp.net-mvc-5 bundle
1个回答
0
投票

以发布模式运行应用程序

© www.soinside.com 2019 - 2024. All rights reserved.