You just have an order of execution problem. Your app.js
says this:
var app = {
init: function () {
_.templateSettings = {
interpolate: /\{\{(.+?)\}\}/g,
evaluate: /\[\[(.+?)\]\]/g
};
window._ = _;
},
//...
so your template settings won't be applied until someone calls app.init()
. If we have a look at one of your views in main.js
, we'll see things like this:
Zurg.Views.AltContent = app.View.extend({
#...
template: _.template([...].join('')),
#...
So your _.template
call happens while main.js
is being loaded and parsed but app.init()
isn't called until later.
All you need to do is arrange for things to happen in this order:
- Load the libaries (jQuery, Underscore, Backbone, ...)
- Adjust the
_.templateSettings
to use your delimiters. - Load your views.
If you move the _.templateSettings
to outside app.init
:
_.templateSettings = {
interpolate: /\{\{(.+?)\}\}/g,
evaluate: /\[\[(.+?)\]\]/g
};
var app = {
init: function () {
// Whatever you really need to initialize things goes here...
},
//...
then everything should work out. BTW, your window._ = _;
trick wasn't doing anything useful so I took it out. And you should include an escape
regex in _.templateSettings
too, you might not need it but completeness is good.