适用于服务器和客户端的模板语言 [英] Template language that works on both server and client
问题描述
我正在寻找一种可以在服务器端(如 ERB)和客户端(如 EJS)上工作的模板解决方案,这样我就不必为在 Rails 和 主干.
首先想到的是Mustache.还有其他的吗?
有人成功做到了吗?
I am looking for a template solution that can work on both server side (like ERB) and client side (like EJS) so I don't have to write the views twice for use in, say, both Rails and Backbone.
The first that comes to mind is Mustache. Any others?
Anyone doing this successfully ?
编辑
我在这里保存了一个汇编.
推荐答案
尝试 Mustache.(Twitter 在他们最近的重新设计中使用了它,因此他们可以在服务器端 Ruby 和客户端 JavaScript 之间共享模板.)
Try Mustache. (Twitter used it in their recent redesign, so they can share templates between server-side Ruby and client-side JavaScript.)
它还支持 Ruby、JavaScript、Python、Erlang、PHP、Perl、Objective-C、Java、.NET、Android、C++、Go、Lua、ooc、ActionScript、ColdFusion、Scala、Clojure、Fantom、CoffeeScript、D,对于 node.js.
It's also available in Ruby, JavaScript, Python, Erlang, PHP, Perl, Objective-C, Java, .NET, Android, C++, Go, Lua, ooc, ActionScript, ColdFusion, Scala, Clojure, Fantom, CoffeeScript, D, and for node.js.
(是的,我知道你在问题中提到了它,但这个答案有链接和内容.)
(Yes, I know you mentioned it in your question, but this answer has links and stuff.)
这篇关于适用于服务器和客户端的模板语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!