【发布时间】:2014-11-07 19:08:45
【问题描述】:
我在 MVC5 站点上遇到了 HandlebarsHelper 编译模板的问题。这是 BundleConfig 的代码:
bundles.Add(new Bundle("~/bundles/templates", new HandlebarsTransformer())
.IncludeDirectory("~/App/templates", "*.hbs", true));
这在本地运行良好,然后我推送到托管 QA 环境的服务器,我收到一个程序集引用错误,说 HandlebarsHelper 插件正在调用侏罗纪 2.1.0.0,但没有找到。所以我通过 Nuget 添加了侏罗纪,从那时起模板停止工作。我从浏览器收到此错误:
铬: Uncaught TypeError: undefined is not a function
火狐: TypeError: templateSpec.call 不是函数
这发生在 handlebars.js 的以下部分:
return function(context, options) {
options = options || {};
var namespace = options.partial ? options : env,
helpers,
partials;
if (!options.partial) {
helpers = options.helpers;
partials = options.partials;
}
var result = templateSpec.call(
container,
namespace, context,
helpers,
partials,
options.data);
if (!options.partial) {
env.VM.checkRevision(container.compilerInfo);
}
return result;
};
我正在跑步:
余烬 1.7.0 Ember-Data 1.0.0-beta.11 车把 1.3.0 jQuery 2.1.1
MVC 5 .Net 4.5.2
我整个早上都在网上搜索,但没有找到任何有效的答案,我尝试删除 Jurassic Nuget 包,但没有帮助。任何想法都将不胜感激,如果有任何其他信息有助于诊断问题,请告诉我。
【问题讨论】:
-
您使用的是哪个版本的车把助手?
-
你能说明你是如何将它注入你的页面的吗?
-
而且是 BundleTable.EnableOptimizations = true;
-
我刚刚注意到nuget包中有一个错误,这意味着您使用的是v2.0。您应该使用 nuget 包的 v1.1。
标签: ember.js handlebars.js handlebarshelper