我正在使用grunt-ember-templates预编译 Handlebars 模板。脚本按以下顺序排列:
<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>
.....
在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;
});
现在我得到这个Uncaught ReferenceError: define is not defined
错误,它指的是define(["ember"], function(Ember){
. 我究竟做错了什么?