3 ms·
I'm working on a project that will let you share the same view code between rails, node and browsers. email me if this is something that you'd like to hack on (
by aaronblohowiak 16y ago
I'm working on a project that will let you share the same view code between rails, node and browsers. email me if this is something that you'd like to hack on (or check my github)
- jashkenas 16y agoI presume you're referring to your EJSRB project: http://github.com/aaronblohowiak/ejsrb/ http://github.com/aaronblohowiak/ejsrb/ I think that the usual way to share views between different languages is to use a language-agnostic templating engine, like Mustache, or Liquid. How does EJSRB differ?
- aaronblohowiak 16y agoEJSRB is a full javascript context, and javascript is a language you probably already know. While our views are separate from controllers and models, they often need more advanced string manipulation than liquid or mustache give you. The fact that it is a full javascript context means you can define your own helpers, and have them still work on the client side. For instance, say you want to generate element ids from the json data. This belongs in a function that is accessible to your view layer, but you shouldn't have to program this twice (once for server, once for client.) AFAIK, there isn't a great way to accomplish this code sharing yet.