| Page 1 of 1 | [ 2 posts ] |
MarcYUI Contributor
|
Hi,
I'm developing a prototype where I use the same Handlebars templates in a server side Java environment and a client side YUI environment. I'm trying to figure out how to best deal with partials. A partial could on the server be something like {{#with user}} {{> /common/user }} {{/user}} I have so far been working on the assumption that all Handlebars templates are delivered through the loader, but I'm not sure how to deal with that in this case. What I'm doing on the loader side is this: Code: YUI_config.groups.handlebars={ base:'./js/handlebars/', combine:true, comboBase:comboBase, root:'handlebars/', patterns : { "-hbs" : { configFn : function(me) { me.path = me.name.replace("-hbs", ".hbs").replace("-","/"); me.requires = [ "handlebars-base", "handlebars-compiler" ]; } } } }; So, when I use a template such as Y.use('inbox-list-hbs') it will be loaded as inbox/list.hbs Any suggestions? Cheers, Marc |
|
I like the idea of using pre-compiled templates in the browser. Where on the server you could compile the raw Handlebars templates into JavaScript functions wrapped as YUI modules. That way you only need the "handlebars-base" module and not the "handlebars-complier" (which is 27KB!), and Loader will know whether a template has been loaded or not since it's a true YUI module.
|
| Page 1 of 1 | [ 2 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group