vtsvang/grunt-dust — pull request #11 by silnijlos (2013-07-25 05:01:37+00:00)
Title: AMD wrapper updated to return a template name from a definition functionh

Hi Vladimir,

I want to suggest a small addition to the AMD wrapper: the proposal is to return a template name from the definition function, which will allow using the variable name as a parameter to the dust rendering engine:
```javascript
define(['dustRuntime', 'views/helloName'], function(dust, viewHelloName) {
dust.render(viewHelloName, {name: 'World'}, function(err, out) {
console.log(out);
});
});
```
The compiled template looks like this:
```javascript
define(["dustRuntime"],function (dust) {
// hello.dust
(function(){dust.register("helloName",body_0);function body_0(chk,ctx){return chk.write("Hello, ").reference(ctx.get("name"),ctx,"h").write("!");}return body_0;})();
return "helloName";
});
```
The benefit of this notation is that you don't need template name constant any more (at least in the js code where tmpl name may be different from the requirejs module id). The change should also be backwards compatible as long as existing code doesn't use any return value for the AMD wrapper.

What do you think?

Thanks,
Sergey