0

所以我下载了 Coffee Sinatra Boilerplate repo ( https://github.com/timwingfield/backbone-sinatra-boilerplate ) 作为开始使用 Backbone 和 Sinatra。

在我过去的很多 Ruby 经验中,我使用 Haml 作为模板/标记语言,所以我决定为 repo 设置 Haml。

我将文件替换为views/templates/title.jst.tplviews/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);
  };
})();

有什么建议么?

4

1 回答 1

0

事实证明 gem 存在问题,切换到(当前待处理的)Pull Request ( https://github.com/rstacruz/sinatra-backbone/pull/12) 修复了我遇到的错误。

于 2014-06-22T19:01:59.187 回答