Cordova index.html from Express+Handlebars layout.hbs? Cordova index.html from Express+Handlebars layout.hbs? express express

Cordova index.html from Express+Handlebars layout.hbs?


I'm not that familiar with express, but the templating aspect should be fairly straightforward with Cordova and Handlebars. Christophe Coenraets has a tutorial on Cordova basics that also covers using Handlebars that can be found here: https://ccoenraets.github.io/cordova-tutorial/handlebars-templates.html

In particular, the call:

var homeTpl = Handlebars.compile($("#home-tpl").html());

compiles the template, and the call:

$('body').html(homeTpl());

sets the body element's html to the compiled template code.

I've got a similar setup with my app using MarionetteJS for the MVC classes. It's a little more complicated, but at the basic level it's just compiling the handlebars template using handlebars.compile(), and then setting the html for the <body> element on the index.html page whenever the user navigates around the app.