meleyal / backbone-on-rails

A simple gem for using Backbone.js with Rails.
MIT License
810 stars 126 forks source link

Replace Eco template with Handlerbars #45

Closed bpc1985 closed 11 years ago

bpc1985 commented 11 years ago

After including this gem https://github.com/leshill/handlebars_assets

It seems that template with JST can not compile, I want to know hơ to replace default template ECO with Handlersbars

jamesaanderson commented 11 years ago

Did you replace the .eco extension with .hbs?

bpc1985 commented 11 years ago

@jamesaanderson: I 'd found solution for this. backbone-on-rails use ECO with JST as default, so we just replace JST template namespace to Handlebars JST by adding this line in file application.rb

HandlebarsAssets::Config.template_namespace = 'JST'

And now, in views just i replace .eco with hbs and then everthing works smoothly with handlebars template

meleyal commented 11 years ago

Glad you got it working. I don't use Handlebars myself, but a patch to generate/destroy other template formats would be great. Ideally the template engine should be an option:

rails generate backbone:scaffold planet --template-engine hbs
rails generate backbone:scaffold planet --template-engine mustache