Skip to content

Commit

Permalink
dont do a require each time a template is accessed
Browse files Browse the repository at this point in the history
  • Loading branch information
selaux committed Mar 9, 2014
1 parent e85b8a1 commit 9c43de1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/View.js
Expand Up @@ -5,6 +5,7 @@ var _ = require('lodash'),
Backbone = require('backbone'),

Handlebars = require('./handlebars/handlebars'),
templateCache = require('../build/compiledTemplates')(Handlebars),
View;

Backbone.$ = $;
Expand Down Expand Up @@ -47,7 +48,7 @@ View = Backbone.View.extend({
},

getCompiledTemplate: function (templateName) {
return require('../build/compiledTemplates')(Handlebars)[templateName];
return templateCache[templateName];
},

render: function () {
Expand Down

0 comments on commit 9c43de1

Please sign in to comment.