Is there any documentation on Mustache best practices when using on the server (with rails) and on the client (with javascript)?
# hello_world.mustache
Hello {{planet}}
# some other file
<%
hello_world_template = File.read(File.dirname(__FILE__) + "/hello_world.mustache")
%>
<script id="hello_world_template" type="text/x-jquery-tmpl">
<%= hello_world_template %>
</script>
<script>
// $.mustache = using mustache.js and a jquery mustache wrapper
// search on "Shameless port of a shameless port"
document.write($.mustache($("#hello_world_template").html(), { "planet" : "World!" }));
</script>
<%= Mustache.render(hello_world_template, :planet => "World!") %>
The above isn't scalable. I'd prefer not to make my own engine for this.
Is there a more complete templating engine that allows reuse of templates on the server and on the client?
Additionally, one that accounts for nested templates on the server and the client?
There is Poirot available: Mustache + Rails 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With