Been researching ways to share my server side templates with javascript. I LOVE me some mote, but my app needs graceful degradation, so I want to render them with client or server as fallback.
Digging around a bit I found a gem which binds directly to Handlebar templates. Real nice piece of work from the author of therubyracer https://github.com/cowboyd/handlebars.rb
So I did what any red-blooded programmer would do and added handlebar support.
I've got the tests all passing right now but given that this is a cargo-cult hack for now - I had to comment out the mote helper and tests as the methods collide with the handlebar helper. I am not sure how to work both renderers in there, or even if this is something you are interested in so I wanted to pick your brain before I pushed on any further.
WIthout wanting to build a full-on Tilt alternative, at first I was thinking we could work setting[:template_language] in there, then handle all the methods conditionally. But I figured all that logic inside each method might hurt performance, so maybe it would be better to abstract the mote and handlebars stuff to their own modules and mix them in conditionally.
Been researching ways to share my server side templates with javascript. I LOVE me some mote, but my app needs graceful degradation, so I want to render them with client or server as fallback.
Digging around a bit I found a gem which binds directly to Handlebar templates. Real nice piece of work from the author of therubyracer https://github.com/cowboyd/handlebars.rb
So I did what any red-blooded programmer would do and added handlebar support.
https://github.com/activestylus/cuba-contrib
Go ahead and check out the handlebars branch.
I've got the tests all passing right now but given that this is a cargo-cult hack for now - I had to comment out the mote helper and tests as the methods collide with the handlebar helper. I am not sure how to work both renderers in there, or even if this is something you are interested in so I wanted to pick your brain before I pushed on any further.
WIthout wanting to build a full-on Tilt alternative, at first I was thinking we could work setting[:template_language] in there, then handle all the methods conditionally. But I figured all that logic inside each method might hurt performance, so maybe it would be better to abstract the mote and handlebars stuff to their own modules and mix them in conditionally.
Let me know what you think