1
votes

I'm using grunt-ember-templates for precompilation of Handlebars templates. The scripts are in following sequence:

<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.3.0/handlebars.runtime.min.js"></script>
<script src="/js/ember.min.js"></script>
<script src="/js/app.js"></script>
<script src="/build/templates.js"></script>
<script src="/js/router.js"></script>
.....

In templates.js:

define(["ember"], function(Ember){

Ember.TEMPLATES["index"] = Ember.Handlebars.template(functionanonymous(Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Ember.Handlebars.helpers);
data = data || {};
var buffer = '', stack1, escapeExpression=this.escapeExpression, self=this;

function program1(depth0,data) {

var buffer = '';
...
.....
return buffer;

});

Now I get this Uncaught ReferenceError: define is not defined Error which refers to define(["ember"], function(Ember){. What am I doing wrong?

1

1 Answers

1
votes

Set amd to false in your configuration:

emberTemplates: {
  compile: {
    options: {
      amd: false,
      templateBasePath: /path\/to\//
    },
    files: {
      "path/to/result.js": "path/to/source.handlebars",
      "path/to/another.js": ["path/to/sources/*.handlebars", "path/to/more/*.handlebars"]
    }
  }
}

https://github.com/dgeb/grunt-ember-templates