5 ms·
TBH there's no reason it needs to be node, you just need to use a template that could work on both client and server. Not that I know of any yet.
by mattmanser 15y ago
TBH there's no reason it needs to be node, you just need to use a template that could work on both client and server.
Not that I know of any yet.
- pilgrim689 15y agoZappa with CoffeeKup can do server and client template sharing. Or jsdom and jsviews if you find Zappa too fancy.
- stdbrouw 15y agoJade (very HAML/Slim-like) can do both client- and server-side rendering, and it can also precompile your template into pure JavaScript so users don't need to download a bulky template engine for it to work.
- vidarh 15y agoMustache (http://mustache.github.com/ http://mustache.github.com/) has implementations in 20+ languages including javascript. The templates themselves are entirely declarative - any logic is contained within a separate object. If you don't need any custom logic at all, you can easily use JSON to pass that object between client and server with no further changes. If you do need some custom logic, it'd be slightly more work, but then again you could just opt to use javascript for any small pieces of logic, as there are V8 and/or Spidermonkey wrappers for most or all of the languages supported by Mustache.