Template for Ruby and Javascript

We are creating a hashtag navigation web page. There is a lot of data that comes in JSON, and we use client-side templates (jQuery) to render them. So, what are the options for reusable templates on both the client and server side (Ruby on rails)? Since we would like to be able to retreat to a URL other than hashtag, in which case the server should display the data.

I saw Mustache.js, but it has poor support for iterating (cannot get an index) or nested templates, and haml-js is not an option, because it uses its own tags for loops.

There are also some workarounds using the server side javascript engine, but I'm not sure if this will be a good solution.

Any suggestions? Thanks.

+8
javascript ruby client-side server-side templating
source share
2 answers

There are several projects that claim that this is possible. The last thing I heard about is Ice . His README mentions several others that you might want to check out. I personally have not tried any of them, so I can not give you recommendations on how well they work, but I would like to hear about your experience with them, as I might try to do this in the near future.

+2
source share

After analyzing all the ones that I could find, I came to the conclusion that this is most attractive:

https://github.com/cowboyd/handlebars.rb

Because the last commit is 4 months ago, which is later than any other I could find, because it uses V8 and the real source of Handlebars.js, and it has good design considerations and a good ruby โ€‹โ€‹interface.

If I choose this route, I will use handlebars.rb

0
source share

All Articles