Simpler version of SlexAxton/require-handlebars-plugin without any extra helpers to configure (i18n). Just a simple Handlebars loader and precompiler for RequireJS.
While this plugin precompiles the templates it does not swap out the Handlebars dependecy to runtime only version on builds automatically. Yet. Pull requests welcome :)
The loader uses the AMD text loader plugin to handle all ajax stuff so make sure you have it and a Handlebars fork with an AMD definition in your setup. Handlebars fork can be grabbed from the SlexAxton/require-handlebars-plugin repo.
After that requirejs-hbs can be used like the original Handlebars plugin:
require(['hbs!app/templates/hello'], function ( template ) {
document.body.innerHTML = template({name: "Epeli"});
});
Currently only overriding the template extension is configurable. In your RequireJS config file, you could optionally add a hbs entry:
require.config({
paths: { ... },
hbs: {
templateExtension: ".html"
},
shim : { ... },
});
Otherwise it defaults to '.hbs' template extension.