gruntjs / grunt-contrib-handlebars

Precompile Handlebars templates to JST file.
http://gruntjs.com/
MIT License
282 stars 126 forks source link

Add support for namespace function in AMD #124

Closed stephanebachelier closed 10 years ago

stephanebachelier commented 10 years ago

It fixes #108 as it add the global namespace and not the last one defined.

The test should be explicit as it return this["JST"] instead of this["JST"]["treeNav"]["leaves"].

define(['handlebars', 'handlebars.helpers'], function(Handlebars) {

this["JST"] = this["JST"] || {};
this["JST"]["countries"] = this["JST"]["countries"] || {};

this["JST"]["countries"]["basic"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  return "Basic template that does nothing.";
  },"useData":true});

this["JST"]["treeNav"] = this["JST"]["treeNav"] || {};
this["JST"]["treeNav"]["leaves"] = this["JST"]["treeNav"]["leaves"] || {};

this["JST"]["treeNav"]["leaves"]["basic"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  return "Basic template that does nothing.";
  },"useData":true});

return this["JST"];
});```