Re:The secrets of Node's success
by aaronblohowiak on Wednesday June 08, 2011 @01:31PM
(#2634119)
IMHO, the merit of sharing code really shines with templates. You can have full-featured Haml-js templates that are rendered on the server and the client. This means your client can make RESTful calls to your JSON api and has full rendering capability in the client.
[ Parent
| on HN ]
I do that by using RDFa as the "templating language". This way the same templating information is usable on both client and server, and also external tools like search engines can benefit from it
Re:The secrets of Node's success
by MatthewPhillips on Thursday June 09, 2011 @08:04AM
(#2636807)
Could you explain? Right now I'm using Jade on the server and Jquery Templates on the client. I'd love to use the same templates on both.
Most of templating is relatively simple rules: put attribute foo of object bar inside this div, repeat members of collection baz here.
These can just as easily be described using RDFa as using TAL or Jade or whatever. The benefit of RDFa is that the templating information stays with the page, so client-side can also utilize it.
The library I made for this is https://github.com/bergie/VIE
Re:The secrets of Node's success
by aaronblohowiak on Thursday June 09, 2011 @06:47PM
(#2639067)
Do you want me to explain Haml-JS shared across both or the parent of your comment to explain RDFa? If you email me - [email protected] - I'll write up a tutorial and send it to you when its ready.