gruntjs / grunt-contrib-handlebars

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

[wip] AMD #105

Closed vladikoff closed 10 years ago

iam4x commented 10 years ago

:thumbsup:

But I have to import the handlebars.amd.js in my RequireJS config to make it works, or Handlebars will be undefined in the generated template file with handlebars.runtime.amd.js

Do you have any ideas? Tanks for the work ;)

edit: Made it working with the handlebars.runtime.amd.js this way:

I import handlebars.runtime.amd.js in my RequireJS config with the name handlebars.runtime and a vendor/handlebars.js as name handlebars. Into my file vendor/handlebars.js I just wrote:

define(['handlebars.runtime'], function (Handlebars) {
  'use strict';
  return Handlebars;
});

This is making the trick, I'll just leave it here if someone needs a similar solution. If you have a cleanier way to achieve this, let me know.

stephanebachelier commented 10 years ago

@vladikoff I've made a PR in #109 to fix Handlebars 2.0 support with AMD. It's based on @nathanjd work.