サーバ(レール付き)とクライアント(javascript付き)を使用している場合のMustacheのベストプラクティスに関するドキュメントはありますか?サーバ(レール)とクライアント(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!") %>
上記はスケーラブルではありません。私はこれのために私自身のエンジンを作っていないことを望むだろう。
サーバーとクライアントでテンプレートを再利用できる、より完全なテンプレートエンジンがありますか?
さらに、サーバーとクライアントのネストされたテンプレートを考慮したテンプレートですか?
これを達成する最善の方法は、Express Webサーバー、RequireJS、Backbone.js、および任意のテンプレートエンジンでNode.jsを使用することです。クライアントまたはサーバー上で美しく動作します。 –