I changed my handlebar template's extension and referred to the same in the function which called handlebarjs' compile function.
It worked perfectly fine with no issues.
But I'm curious to know if anyone else tried that? Please let me know if you think this could cause problems down the road for any reason.
For some reason I feel that the very extension .handlebars is a bit long. I prefer to keep it to a max of 4 chars ... something like .txt or .html.
Please let me know if you see any issues with this approach.
For example, I renamed login.handlebars to login.html
In the getTemplate function (as shown below), I will call this template for compilation
function getTemplate(name) {
if (Handlebars.templates === undefined || Handlebars.templates[name] === undefined) {
$.ajax({
url : "templates/" + name + ".html",
success : function(data) {
if (Handlebars.templates === undefined) {
Handlebars.templates = {};
}
Handlebars.templates[name] = Handlebars.compile(data);
},
async : false
});
}
return Handlebars.templates[name];
}