Path.map('#/:lang/:section').to(function() { var section = this.params['section']; var lang = this.params['lang']; // Get the handlebars template. var template = Inmadusa.templates[section]; // Get the resources for the language. var resources = Inmadusa.getResources(lang, section); // build the proper HTML for the route. var sectionHtml = templates(resources); // load the content into the DOM. $('.sectionContent').html(sectionHtml); });
One thing I forgot to mention is how to load the web site during development. For this I like to use the local-web-server npm package to quickly start a web server from any directory. Once installed you start it from the root of the repo:
> ws
It has a lot of options, but by default it binds to port 3000, so you can load the site from http://localhost:3000. On a future post, I'll swap this for browser-sync so that it can be part of the gulp build and support live reload. 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.