set handlebars compiler in jammit config.yml (handlebars worries about maintaining a compilation cache, we don't have to do this manually.) [ci skip]

This commit is contained in:
danielgrippi 2012-02-05 21:18:08 -08:00
parent a142911a8f
commit 7d60d96132
5 changed files with 6 additions and 10 deletions

View file

@ -3,7 +3,7 @@ embed_assets: datauri
compress_assets: on
gzip_assets: off
template_function: off
template_function: Handlebars.compile
template_extension: 'handlebars'
javascripts:

View file

@ -1,5 +1,5 @@
package_assets: on
template_function: off
template_function: Handlebars.compile
template_extension: 'handlebars'
javascripts:

View file

@ -1,4 +1,4 @@
/* we need to wrap this in a document ready to ensure JST is accessible */
$(function(){
Handlebars.registerPartial('status-message', Handlebars.compile(JST['status-message']))
Handlebars.registerPartial('status-message', JST['status-message'])
})

View file

@ -1,4 +1,5 @@
app.views.Base = Backbone.View.extend({
presenter : function(){
return this.defaultPresenter()
},
@ -22,13 +23,8 @@ app.views.Base = Backbone.View.extend({
},
renderTemplate : function(){
var templateHTML //don't forget to regenerate your jasmine fixtures ;-)
var presenter = _.isFunction(this.presenter) ? this.presenter() : this.presenter
window.templateCache = window.templateCache || {}
templateHTML = JST[this.templateName];
this.template = templateCache[this.templateName] = templateCache[this.templateName] || Handlebars.compile(templateHTML);
this.template = JST[this.templateName]
$(this.el).html(this.template(presenter));
this.postRenderTemplate();
},

View file

@ -12,6 +12,7 @@
#
src_files:
# load up our outputted templates, bound to window.JST
- public/javascripts/vendor/handlebars-1.0.0.beta.6.js
- public/assets/app.js
- public/javascripts/vendor/underscore.js
@ -30,7 +31,6 @@ src_files:
- public/javascripts/vendor/markdown/*
- public/javascripts/vendor/jquery.placeholder.js
- public/javascripts/vendor/backbone.js
- public/javascripts/vendor/handlebars-1.0.0.beta.6.js
- public/javascripts/fileuploader-custom.js
- public/javascripts/jquery.autocomplete-custom.js
- public/javascripts/diaspora.js