Mar*_*son 4 javascript ruby-on-rails mustache
在服务器(使用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!") %>
Run Code Online (Sandbox Code Playgroud)
以上是不可扩展的.我不想为此制作自己的发动机.
是否有更完整的模板引擎允许在服务器和客户端上重用模板?
另外,还有一个可以解释服务器和客户端上的嵌套模板吗?
| 归档时间: |
|
| 查看次数: |
3382 次 |
| 最近记录: |