所以我下载了 Coffee Sinatra Boilerplate repo ( https://github.com/timwingfield/backbone-sinatra-boilerplate ) 作为开始使用 Backbone 和 Sinatra。
在我过去的很多 Ruby 经验中,我使用 Haml 作为模板/标记语言,所以我决定为 repo 设置 Haml。
我将文件替换为views/templates/title.jst.tpl
,views/templates/title.jst.haml
并将 haml.js 文件添加到 js 供应商文件夹中,将其指定为 server.rb 中的依赖项以处理undefined: Haml is not a function
错误。
现在我要处理的错误是
Uncaught TypeError: undefined is not a function
指向return c["templates/title"].apply(this, arguments);
输出的jst.js:
(function(){
var c = {};
if (!window.JST) window.JST = {};
JST["templates/title"] = function() {
if (!c["templates/title"]) c["templates/title"] = (Haml.compile("%h2 My Blog\n"));
return c["templates/title"].apply(this, arguments);
};
})();
有什么建议么?