서버 (레일 포함) 및 클라이언트 (자바 스크립트 사용)를 사용할 때의 우수 사례 우수 사례가 있습니까?서버 (레일) 및 클라이언트 (자바 스크립트)에서 콧수염 렌더링
# 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 웹 서버, RequireJS, Backbone.js 및 템플릿 엔진과 함께 Node.js를 사용하는 것이 가장 좋은 방법이라는 것을 발견했습니다. 클라이언트 또는 서버에서 아름답게 작동합니다. –