leshill / handlebars_assets

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

Server side HTML Handlebars templates #10

Open grigio opened 12 years ago

grigio commented 12 years ago

Is possible to access to the handlebars templates server side?. I mean the equivalent of poirot or stache which use mustache instead of handlebars

<%= template_include_tag 'post_list' %>

in https://github.com/olivernn/poirot

noiseunion commented 11 years ago

+1

leshill commented 11 years ago

Hi @grigio, @noiseunion,

The template is available to your JavaScript as an entry of the HandlebarsTemplates object (or whatever you have configured for your namespace).

So I am a bit confused by this since the template_include_tag just adds the template to the page as a script tag (at least that is what I think it does :) What am I missing?

noiseunion commented 11 years ago

I looking for something similar to this: https://github.com/railsware/sht_rails.

We have been looking at using the Handlebars_assets gem in conjunction with the SHT gem, however it would be nice to just have a one-stop-shop on this issue...and I like the way Handlebars_Assets works with regards to what it does, would be really nice to be able to use the same template both client and server-side in a rails app.

leshill commented 11 years ago

Hi @noiseunion,

Interesting. So you want to render the Handlebars template inside a rails view on the server OR as a JavaScript template in the browser?

Let me think about it, I might have some time this week.

noiseunion commented 11 years ago

yeah that would be the goal. :) Would eliminate the need for duplicating a template which would be awesome!

leshill commented 11 years ago

Hi @grigio, @noiseunion,

Do either of you want to take a stab at this? I am still swamped.

noiseunion commented 11 years ago

Sorry for the delay in getting back. I would be willing to give it a whirl when I get a chance. Just not sure when that will be yet.

variousauthors commented 10 years ago

Oh man! I want this too.

activist commented 9 years ago

+1