asp.net - Visual Studio 和 Knockout.js - 捆绑、缩小和约定

标签 asp.net visual-studio asp.net-mvc-4 asp.net-optimization

我在 ASP.NET MVC4 和 Visual Studio 中使用捆绑和缩小。

公约说:

  • 当“FileX.min.js”和“FileX.js”存在时,选择“.min”文件进行发布。
  • 选择非“.min”版本进行调试。
  • 忽略仅由 IntelliSense 使用的“-vsdoc”文件(例如 jquery-1.6.2-vsdoc.js)。

  • 问题是 debug.js 扩展也被完全忽略,当我通过 NuGet 使用敲除和敲除映射时,这些扩展随附。所以即使在 Debug模式下我也总是得到缩小版本?

    我可以将文件从 .debug.js 重命名为 .min.js 以在 Debug模式下获得非缩小版本,但这不会通过 nuget 破坏更新功能吗?

    .debug.js 文件有解决方案吗?

    最佳答案

    以下是 RTM 1.0 中完整的当前忽略列表默认约定:

            ignoreList.Ignore("*.intellisense.js");
            ignoreList.Ignore("*-vsdoc.js");
            ignoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled);
            ignoreList.Ignore("*.min.js", OptimizationMode.WhenDisabled);
            ignoreList.Ignore("*.min.css", OptimizationMode.WhenDisabled);
    

    所以当 debug=false 时 debug.js 将被忽略。重命名或清除忽略列表是两种简单的解决方法。

    关于asp.net - Visual Studio 和 Knockout.js - 捆绑、缩小和约定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12025251/

    相关文章:

    c# - MVC ViewModel EntityFrameWork ICollection,IEnumerable 虚拟类

    c# - ajax使用处理程序请求到 Razor 页面

    asp.net - 发布后布局 cshtml 未呈现

    c# - Visual Studio 2008 : Unit-Test methods in generic classes are not detected properly

    c# - 在整个 session 中维护数据表和变量

    visual-studio - 加载配置文件时出错 : Failed to start monitoring changes because the network BIOS command limit has been reached

    visual-studio - 相当于 $(MAKECMDGOALS) 的 MS nmake

    asp.net-mvc-4 - 单元测试 - httpcontext 为 null,websecurity.CurrentUserId 也未填充

    c# - asp.net c#代码错误(mysql数据库连接)

    javascript - 使用 javascript 和 Asp.Net 从其文件夹中删除图像