mattacular/grunt-handlebars-compiler — pull request #4 by tfarnsworth (2013-12-18 07:48:05+00:00)
Title: Compiled templates are wrapped in a single require statement

Hi! I'm using this plugin with the exportAMD option. It worked great for a single template, but when compiling multiple templates into a single file, I ran into issues. The compiled file was wrapping each template in it's own require statement. So it looked something like:

```
define(['handlebars'], function (Handlebars) {
templates['templateOne'] = template(function (Handlebars,depth0,helpers,partials,data) {
...
}
}
define(['handlebars'], function (Handlebars) {
templates['templateTwo'] = template(function (Handlebars,depth0,helpers,partials,data) {
...
}
}
```
I believe the issue is caused by the modules not having names but being in the same file, which doesn't play nicely in require. Since all the templates just need to require Handlebars, I rearranged the code a bit so that it generates something more like:
```
define(['handlebars'], function (Handlebars) {
templates['templateOne'] = template(function (Handlebars,depth0,helpers,partials,data) {
...
}
templates['templateTwo'] = template(function (Handlebars,depth0,helpers,partials,data) {
...
}
}
```

This works perfectly in my app, and I've updated the AMD tests to use multiple files. I would love to hear your thoughts, though!