将Web Optimization Framework升级到RTM

时间:2012-09-11 11:05:40

标签: asp.net-mvc-4 .net-4.5 asp.net-optimization web-optimization

当我从 Microsoft ASP.NET Web Optimization Framework 1.0.0-beta2 升级到 Microsoft ASP.NET Web Optimization Framework 1.0.0 时,通过nuget我的一些脚本不再呈现给页面。这看起来很奇怪,我想知道我是否需要做一些修改来升级它。

使用beta2,我会得到以下脚本:

<script src="/Scripts/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-1.8.1.js" type="text/javascript"></script>
<script src="/Scripts/less-1.3.0.min.js" type="text/javascript"></script>
<script src="/Scripts/bootstrap.min.js" type="text/javascript"></script>
<script src="/Scripts/coffee-script.js" type="text/javascript"></script>
<script src="/Scripts/underscore-min.js" type="text/javascript"></script>
<script src="/Scripts/knockout-2.0.0.js" type="text/javascript"></script>
<script src="/Scripts/knockout-2.1.0.js" type="text/javascript"></script>
<script src="/Scripts/backbone-min.js" type="text/javascript"></script>
<script src="/Scripts/backbone-modelref.js" type="text/javascript"></script>
<script src="/Scripts/backbone-relational.js" type="text/javascript"></script>
<script src="/Scripts/knockback.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.gridster.min.js" type="text/javascript"></script>
<script src="/Scripts/dragdealer.js" type="text/javascript"></script>
<script src="/Scripts/pminject.coffee" type="text/javascript"></script>

但是使用RTM我只能得到:

<script src="/Scripts/jquery-1.8.1.js"></script>
<script src="/Scripts/coffee-script.js"></script>
<script src="/Scripts/underscore-min.js"></script>
<script src="/Scripts/knockout-2.0.0.debug.js"></script>
<script src="/Scripts/knockout-2.1.0.debug.js"></script>
<script src="/Scripts/backbone-min.js"></script>
<script src="/Scripts/backbone-modelref.js"></script>
<script src="/Scripts/backbone-relational.js"></script>
<script src="/Scripts/dragdealer.js"></script>
<script src="/Scripts/pminject.coffee"></script>

我的捆绑配置非常简单:

public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-1.*"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                        "~/Scripts/jquery-ui*"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.unobtrusive*",
                        "~/Scripts/jquery.validate*"));

            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/openid").Include(
                        "~/Scripts/openid-jquery.js",
                        "~/Scripts/openid-en.js"));

            bundles.Add(new ScriptBundle("~/bundles/less").Include(
                        "~/Scripts/less-1.*"));

            bundles.Add(new ScriptBundle("~/bundles/coffeescript").Include(
                        "~/Scripts/coffee-script.js"));

            bundles.Add(new ScriptBundle("~/bundles/underscore").Include(
                        "~/Scripts/underscore-min.js"));

            bundles.Add(new ScriptBundle("~/bundles/knockout").Include(
                        "~/Scripts/knockout-2.*"));

            bundles.Add(new ScriptBundle("~/bundles/backbone").Include(
                        "~/Scripts/backbone-*"));

            bundles.Add(new ScriptBundle("~/bundles/knockback").Include(
                        "~/Scripts/knockback.min.js"));

            bundles.Add(new ScriptBundle("~/bundles/gridster").Include(
                        "~/Scripts/jquery.gridster.min.js"));

            bundles.Add(new ScriptBundle("~/bundles/dragdealer").Include(
                        "~/Scripts/dragdealer.js"));

            bundles.Add(new ScriptBundle("~/bundles/pminject").Include(
                        "~/Scripts/pminject.coffee"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                        "~/Scripts/bootstrap.min.js"));
}

有人知道我需要做哪些额外步骤或更改才能升级吗?

1 个答案:

答案 0 :(得分:3)

从Beta到RTM的一个区别是,当debug mode = true时,默认会忽略* .min.js。您可以通过清除BundleTable.Bundles上的IgnoreList来解决此问题,或者您可以将任何只有.min.js版本的文件重命名为.js,以便包含它们。

此行为导致许多人遇到问题,因此我们正在研究如何在功能版本中做得更好。