Re:CoffeeScript -- You Are Totally Gonna Hate It
by aaronblohowiak on Saturday July 17, 2010 @01:18PM
(#1524191)
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)
[ Parent
| on HN ]
Re:CoffeeScript -- You Are Totally Gonna Hate It
by jashkenas on Saturday July 17, 2010 @01:35PM
(#1524222)
I presume you're referring to your EJSRB project:
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?
Re:CoffeeScript -- You Are Totally Gonna Hate It
by aaronblohowiak on Monday July 19, 2010 @01:23AM
(#1527708)
EJSRB 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.