3 ms·
That's a similar technique to what I'm doing; I use language-agnostic templates (mustache) so that I can do a full server side render, and then my Backbone app
by ajacksified 14y ago
That's a similar technique to what I'm doing; I use language-agnostic templates (mustache) so that I can do a full server side render, and then my Backbone app initializes with bootstrapped data. This way, we can progressively enhance the site and have a quick page load and at the same time build a single page Backbone app.
- carlosedp 14y agoDo you share the same templates between server and backbone? I'm trying to escape code duplication as much as I can. Do anyone knows any pattern to have the server templates sent to backbone avoiding duplication?
- gerrit 14y agoI've been using hogan.js to compile mustache templates to JavaScript functions on the server-side and write them to a js file that is then served to the browser: Templates={} Templates['templatename']=function(){/*compiled template*/} They can then be referenced quite easily in your backbone render methods.