For example, this is the folder structure:
To compile all the templates manually you can use:
>handlebars templates -o templates.js
With this file in place, I modified the router to load the appropriate template depending on the route:
Path.map('#/:lang/:section').to(function() { var section = this.params['section']; var lang = this.params['lang']; // TODO: get the resources for the language. // build the proper HTML for the route. var sectionHtml = Handlebars.templates[section](); // load the content into the DOM. $('.sectionContent').html(sectionHtml); });
In a subsequent post I'll go over how to automate the template generation using a gulp task. In the mean time, you can visit the live site or check the source code.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.