leshill / handlebars_assets

Use handlebars.js templates with the Rails asset pipeline.
MIT License
647 stars 159 forks source link

Templates don't get added to Template Namespace #57

Closed jabberfest closed 11 years ago

jabberfest commented 11 years ago

Using the following require is the only way to get the templates added to the global namespace automatically.

//= require_tree ./templates

HandlebarsTemplates'contacts/new';


What if we don't want to include all the templates in our application? An example is a Rails site that may have multiple backbone apps. We don't always want to pull in all the templates.

If we specify

//= require ./templates/foo/bar

then HandlebarsTemplates'foo/bar'; should work, but it doesn't because for some reason HandlebarsTemplates becomes undefined.

jabberfest commented 11 years ago

Newbe mistake. :-/ I was requiring my backbone views before I required my template so it was trying to access a HandblebarsTemplate that didn't exist.