grunt-contrib-handlebars icon indicating copy to clipboard operation
grunt-contrib-handlebars copied to clipboard

Adds support to export to ES2015 module

Open ffflabs opened this issue 8 years ago • 0 comments

Along with node, AMD and CommonJS output format, this PR enables the task to output compiled templates into an ES2015 module.

Since this property is undefined in ES2015, the task now accepts a root option that will be used to replace this. If not set, and desired format is es2015, root will default to templates.

Both node and es2015 output formats need a namespace property. If these format are chosen, and the namespace option is falsy, said property will default to JST

Changes:

  • Updates README.md with instructions to use es2015 output format.
  • It accepts a root property (since 'this' is undefined in ES2015 modules)
  • It forces a non-falsy namespace option when using node or es2015 formats
  • It prepends a var declaration for the root property when it is declared
  • Simplifies amd define block parsing when the property is an array

ffflabs avatar Jul 26 '17 22:07 ffflabs