在服务器(使用 rails)和客户端(使用 javascript)上使用时,是否有关于 Mustache 最佳实践的文档?
# 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!") %>
以上是不可扩展的。我不想为此制作自己的引擎。
是否有更完整的模板引擎允许在服务器和客户端重用模板?
此外,一个解释服务器和客户端上的嵌套模板?