【发布时间】:2013-02-10 20:00:47
【问题描述】:
我正在尝试使用 ASP.Nets BundleTable 来优化一些 javascript 文件,但遇到了一个问题,即在缩小代码时特定插件 (jQuery-Timepicker) 无法工作。见here。
捆绑代码目前类似于:
// Add our commonBundle
var commonBundle= new Bundle("~/CommonJS" + culture.ToString());
// JQuery and related entries.
commonBundle.Include("~/Scripts/jquery-1.7.2.js");
commonBundle.Include("~/Scripts/jquery-ui-1.8.22.js");
commonBundle.Include("~/Scripts/jquery.cookie.js");
commonBundle.Include("~/Scripts/jquery-ui/jquery-ui-timepicker-addon.js"); // This is the one that does not work when bundled
// JS Transformer
commonBundle.Transforms.Add(new JsMinify());
BundleTable.Bundles.Add(commonBundle);
如果我删除 jquery-ui-timepicker-addon.js 文件,然后将其单独包含在我的网页中,那么它可以正常工作。 (否则我会收到Uncaught TypeError: undefined is not a function 错误)。
我想知道我是否可以以某种方式设置我的捆绑代码以跳过缩小这个文件(但它仍然包含在捆绑中)?我一直在环顾四周,但没有提出任何解决方案。
【问题讨论】:
-
您不能将时间选择器的
commonBundle.Include行移到转换后吗?
标签: asp.net-mvc-3 asp.net-mvc-4 bundle asp.net-optimization system.web.optimization