Templating language for both Ruby and client-side JS

Is there a templating language that has both server-side ruby (pref. rails) and JS renderer?

Here is why this would be useful: Consider you want to display a big list of songs. You render the first 50 and a "show more" button.

"Show more" would link to the next 50 songs or would load those with AJAX if JavaScript is enabled.

The simple solution is to return a rendered piece of HTML from the server, but consider how nice would it be songs were returned as JSON and then were rendered using the same template on the client side.

Answers


Mustache.

It is Ruby based but there are several different implementations, including JS.


Need Your Help

PHP regular expressions issue - preg_match not returning any results

php regex preg-match expression

I have a file called 1.txt and I am trying to display its part on the website.

Test if connection is an error

php conditional

I am using this script here and it does not always want to connect to the server I set it to. When it doesn't, it'll show an error "Failed to receive status". I'm wondering how can I test to see if...