So I downloaded the Coffee Sinatra Boilerplate repo (https://github.com/timwingfield/backbone-sinatra-boilerplate) as a starting point for playing around with both Backbone and Sinatra.
A lot of my past Ruby experience I'd used Haml as the templating/markup language, so I decided to setup Haml for the repo.
I replaced the file views/templates/title.jst.tpl
with views/templates/title.jst.haml
, and added the haml.js file to the js vendor folder, specifying it as a dependency in server.rb to deal with the undefined: Haml is not a function
error.
Now the error I'm trying to deal with is
Uncaught TypeError: undefined is not a function
pointing at return c["templates/title"].apply(this, arguments);
in the outputted 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);
};
})();
Any suggestions?
It turns out there is an issue with the gem, switching to the (currently pending) Pull Request (https://github.com/rstacruz/sinatra-backbone/pull/12
) fixes the error I'm getting.