define(["handlebars"], function(Handlebars) {
  var buildMap = {};

  return {

    // http://requirejs.org/docs/plugins.html#apiload
    load: function (name, parentRequire, onload, config) {

      if (config.isBuild) {
        // Use node.js file system module to load the template.
        // Sorry, no Rhino support.
        var fs = nodeRequire("fs");
        var fsPath = config.dirBaseUrl + "/" + name + ".hbs";
        buildMap[name] = fs.readFileSync(fsPath).toString();
        onload();
      }
      else {
        // In browsers use the text-plugin to the load template. This way we
        // don't have to deal with ajax stuff
        parentRequire(["text!" + name + ".hbs"], function(raw) {
          // Just return the compiled template
          onload(Handlebars.compile(raw));
        });
      }

    },

    // http://requirejs.org/docs/plugins.html#apiwrite
    write: function (pluginName, name, write) {
      var compiled = Handlebars.precompile(buildMap[name]);
      // Write out precompiled version of the template function as AMD
      // definition.
      write(
        "define('hbs!" + name + "', ['handlebars'], function(Handlebars){ \n" +
          "return Handlebars.template(" + compiled.toString() + ");\n" +
        "});\n"
      );
    }

  };
});

@@ -58,18 +58,52 @@
 Map = %7B%7D
+,%0A      templateExtension = %22.hbs%22
 ;%0A
-
 %0A  retur
@@ -217,24 +217,175 @@
  config) %7B%0A%0A
+      // Get the template extension.%0A      var ext = (config.hbs && config.hbs.templateExtension ? config.hbs.templateExtension : templateExtension);%0A%0A
       if (co
@@ -590,22 +590,19 @@
  name + 
-%22.hbs%22
+ext
 ;%0A      
@@ -681,22 +681,16 @@
 %0A      %7D
-%0A     
  else %7B%0A
@@ -852,22 +852,19 @@
  name + 
-%22.hbs%22
+ext
 %5D, funct

Allow customizing a template extension in requirejs config