Ember.js-如果需要,通过Grunt(Node.js)无法识别把手

Ember.js-如果需要,通过Grunt(Node.js)无法识别把手,node.js,ember.js,handlebars.js,gruntjs,Node.js,Ember.js,Handlebars.js,Gruntjs,是否有其他人使用Grunt作为Emberweb应用程序的构建工具,并且正在经历与我相同的行为?此时,我正在使用版本RC3中的框架,我可以轻松地使用我的构建工具,导入所有必要的库,并对它们进行丑陋和压缩,一切工作都很顺利 无论如何,至少自从Ember RC5以来,我无法再使用Grunt构建我的应用程序,因为Ember将不再识别把手。它总是抱怨Ember车把需要1.0.0-rc.4版的车把。在链接到Ember之前,在链接到Handlebar文件的HTML头中包含一个脚本标记。之后,它说无法读取未定义

是否有其他人使用
Grunt
作为
Ember
web应用程序的构建工具,并且正在经历与我相同的行为?此时,我正在使用版本
RC3
中的框架,我可以轻松地使用我的构建工具,导入所有必要的库,并对它们进行丑陋和压缩,一切工作都很顺利

无论如何,至少自从
Ember RC5
以来,我无法再使用
Grunt
构建我的应用程序,因为Ember将不再识别把手。它总是抱怨
Ember车把需要1.0.0-rc.4版的车把。在链接到Ember之前,在链接到Handlebar文件的HTML头中包含一个脚本标记。
之后,它说
无法读取未定义的
的属性“COMPILER\u REVISION”,这导致我假设
Ember
无法识别包含的
Handlebar

除了对js文件的引用(使用Ember RC5/6代替RC3,使用Handlebar RC4代替RC3),我在我的
app.js
(库/框架的顺序没有改变)中没有做任何更改。但从那时起,似乎有什么东西打破了
Ember.handlebar
的初始化

我这里有什么不对劲吗?有没有一个解决方案可以让我继续使用
Grunt
作为构建工具


编辑 这是我的
grunfile.js

/*jshint camelcase: false */
/*global module:false */
module.exports = function (grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    meta: {
      dev: {
        buildPath: '.'
      },
      prod: {
        buildPath: '.'
      }
    },

    /*
     Task for uglifyng the application javascript file in production environment
     */
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
            '<%= grunt.template.today("yyyy-mm-dd") %> */'
      },
      prod: {
        files: [
          {
            src: '<%= meta.prod.buildPath %>/js/application.js',
            dest: '<%= meta.prod.buildPath %>/js/application.min.js'
          }
        ]

      }
    },

    /*
     Task for creating css files out of the scss files
     */
    compass: {
      prod: {
        options: {
          environment: 'production',
          noLineComments: true,
          outputStyle: 'expanded',
          cssDir: '<%= meta.prod.buildPath %>/css',
          fontsDir: '<%= meta.prod.buildPath %>/fonts',
          imagesDir: '<%= meta.prod.buildPath %>/images',
          javascriptsDir: '<%= meta.prod.buildPath %>/js'
        }
      },
      dev: {
        options: {
          environment: 'development',
          noLineComments: false,
          outputStyle: 'expanded',
          cssDir: '<%= meta.dev.buildPath %>/css',
          fontsDir: '<%= meta.dev.buildPath %>/fonts',
          imagesDir: '<%= meta.dev.buildPath %>/images',
          javascriptsDir: '<%= meta.dev.buildPath %>/js'
        }
      }
    },

    /*
     Task to minify all css files in production mode.
     All css files will end with '.min.css' instead of
     just '.css'.
     */
    cssmin: {
      minify: {
        expand: true,
        cwd: '<%= meta.prod.buildPath %>/css/',
        src: ['*.css', '!*.min.css'],
        dest: '<%= meta.prod.buildPath %>/css/',
        ext: '.min.css'
      }
    },

    /*
     Clean up the production build path
     */
    clean: {
      cssd: ['<%= meta.prod.buildPath %>/css/**/*']
    },


    /*
     A simple ordered concatenation strategy.
     This will start at app/app.js and begin
     adding dependencies in the correct order
     writing their string contents into 'application.js'

     Additionally it will wrap them in evals
     with @ sourceURL statements so errors, log
     statements and debugging will reference
     the source files by line number.

     This option is set to false for production.
     */
    neuter: {
      prod: {
        options: {
          includeSourceURL: false
        },
        files: [
          {
            src: 'app/app.js',
            dest: '<%= meta.prod.buildPath %>/js/application.js'
          }
        ]
      },
      dev: {
        options: {
          includeSourceURL: true
        },
        files: [
          {
            src: 'app/app.js',
            dest: '<%= meta.dev.buildPath %>/js/application.js'
          }
        ]
      }
    },

    /*
     Watch files for changes.

     Changes in dependencies/ember.js or application javascript
     will trigger the neuter task.

     Changes to any templates will trigger the ember_templates
     task (which writes a new compiled file into dependencies/)
     and then neuter all the files again.
     */
    watch: {
      application_code: {
        files: ['js/dependencies/ember.js', 'app/**/*.js'],
        tasks: ['neuter:dev']
      },
      compass: {
        files: [
          'styles/**/*.scss'
        ],
        tasks: ['compass:dev']
      }
    },

    /*
     Runs all .html files found in the test/ directory through PhantomJS.
     Prints the report in your terminal.
     */
    qunit: {
      all: ['test/**/*.html']
    },

    /*
     Reads the projects .jshintrc file and applies coding
     standards. Doesn't lint the dependencies or test
     support files.
     */
    jshint: {
      all: ['Gruntfile.js', 'app/**/*.js', 'test/**/*.js', '!js/dependencies/*.*', '!test/support/*.*'],
      options: {
        jshintrc: '.jshintrc'
      }
    },

    /*
     Generate the YUI Doc documentation.
     */
    yuidoc: {
      name: '<%= pkg.name %>',
      description: '<%= pkg.description %>',
      version: '<%= pkg.version %>',
      options: {
        paths: '<%= meta.dev.buildPath %>/app/',
        outdir: '<%= meta.dev.buildPath %>/yuidocs/'
      }
    },

    /*
     Find all the <whatever>_test.js files in the test folder.
     These will get loaded via script tags when the task is run.
     This gets run as part of the larger 'test' task registered
     below.
     */
    build_test_runner_file: {
      all: ['test/**/*_test.js']
    }
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-neuter');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-yuidoc');

  /*
   A task to build the test runner html file that get place in
   /test so it will be picked up by the qunit task. Will
   place a single <script> tag into the body for every file passed to
   its coniguration above in the grunt.initConfig above.
   */
  grunt.registerMultiTask('build_test_runner_file', 'Creates a test runner file.', function () {
    var tmpl = grunt.file.read('test/support/runner.html.tmpl');
    var renderingContext = {
      data: {
        files: this.filesSrc.map(function (fileSrc) {
          return fileSrc.replace('test/', '');
        })
      }
    };
    grunt.file.write('test/runner.html', grunt.template.process(tmpl, renderingContext));
  });

  /*
   A task to run the application's unit tests via the command line.
   It will
   - convert all the handlebars templates into compile functions
   - combine these files + application files in order
   - lint the result
   - build an html file with a script tag for each test file
   - headlessy load this page and print the test runner results
   */
  grunt.registerTask('test', ['neuter', 'jshint', 'build_test_runner_file', 'qunit']);

  /*
   Configures all tasks which will be executed with production setup
   */
  grunt.registerTask('prod_tasks', ['clean', 'compass:prod', 'cssmin', 'neuter:prod', 'uglify:prod']);

  /*
   Setup for the production build. Sets the production build path.
   */
  grunt.registerTask('prod', 'Production Build', function () {
    grunt.task.run('prod_tasks');
  });

  /*
   Configures all tasks which will be executed with development setup
   */
  grunt.registerTask('dev_tasks', ['compass:dev', 'neuter:dev', 'watch']);

  /*
   Setup for the development build. Sets the development build path.
   */
  grunt.registerTask('dev', 'Development Build', function () {
    grunt.task.run('dev_tasks');
  });

  // Default task
  grunt.registerTask('default', 'dev');

  /*
   Configures all tasks which will be executed with doc setup
   */
  grunt.registerTask('doc_tasks', ['yuidoc']);

  /*
   Setup for the YUI doc generation.
   */
  grunt.registerTask('doc', 'Generate YuiDoc Documentation for the App', function () {
    grunt.task.run('doc_tasks');
  });

};
/*jshint-camecase:false*/
/*全局模块:false*/
module.exports=函数(grunt){
grunt.initConfig({
pkg:grunt.file.readJSON('package.json'),
元:{
开发人员:{
构建路径:'.'
},
产品:{
构建路径:'.'
}
},
/*
生产环境中应用程序javascript文件的uglifyng任务
*/
丑陋的:{
选项:{
横幅:'/*!-v-'+
' */'
},
产品:{
档案:[
{
src:'/js/application.js',
dest:“/js/application.min.js”
}
]
}
},
/*
使用scss文件创建css文件的任务
*/
指南针:{
产品:{
选项:{
环境:"生产",,
诺林评论:没错,
outputStyle:“已扩展”,
cssDir:“/css”,
fontsDir:“/fonts”,
imagesDir:“/images”,
javascriptsDir:“/js”
}
},
开发人员:{
选项:{
环境:"发展",,
诺林评论:错,
outputStyle:“已扩展”,
cssDir:“/css”,
fontsDir:“/fonts”,
imagesDir:“/images”,
javascriptsDir:“/js”
}
}
},
/*
在生产模式下缩小所有css文件的任务。
所有css文件将以“.min.css”结尾,而不是
只要“.css”。
*/
cssmin:{
缩小:{
是的,
cwd:“/css/”,
src:['*.css','!*.min.css'],
dest:“/css/”,
分机:'.min.css'
}
},
/*
清理生产构建路径
*/
清洁:{
cssd:['/css/***']
},
/*
一种简单的有序连接策略。
这将从app/app.js开始,然后开始
以正确的顺序添加依赖项
将字符串内容写入“application.js”
此外,它还将它们包装在evals中
使用@sourceURL语句,以便记录错误
语句和调试将引用
按行号显示源文件。
对于生产,此选项设置为false。
*/
中性化:{
产品:{
选项:{
includeSourceURL:false
},
档案:[
{
src:'app/app.js',
dest:“/js/application.js”
}
]
},
开发人员:{
选项:{
includeSourceURL:true
},
档案:[
{
src:'app/app.js',
dest:“/js/application.js”
}
]
}
},
/*
监视文件的更改。
依赖项/ember.js或应用程序javascript中的更改
将触发中性任务。
对任何模板的更改都将触发ember_模板
任务(将新编译的文件写入dependencies/)
然后再次对所有文件进行中性化。
*/
观察:{
应用程序代码:{
文件:['js/dependencies/ember.js','app/***.js'],
任务:['neuter:dev']
},
指南针:{
档案:[
“styles/***.scss”
],
任务:['compass:dev']
}
},
/*
通过PhantomJS运行在test/目录中找到的所有.html文件。
在终端中打印报告。
*/
昆特:{
全部:['test/***/.html']
},
/*
读取projects.jshintrc文件并应用编码
标准。不会忽略依赖项或测试
支持文件。
*/
jshint:{
全部:['Gruntfile.js','app/***/.js','test/***/.js','!js/dependencies/*.','!test/support/*.'],
选项:{
jshintrc:“.jshintrc”
}
},
/*
生成YUI文档。
*/
尤伊多克:{
名称:“”,
说明:“”,
版本:“”,
选项:{
路径:'/app/',
outdir:“/yuidocs/”
}
},
/*
在test文件夹中找到所有的_test.js文件。
这些将在任务运行时通过脚本标记加载。
这将作为注册的较大“测试”任务的一部分运行
在下面
*/
生成\u测试\u运行程序\u文件:{
全部:['test/***\u test.js']
}
});
grunt.loadNpmTasks(“grunt-contrib-uglify”);
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks(“grunt-contrib-qunit”);
grunt.loadNpmTasks(“grunt-neuter”);
grunt.loadNpmTasks(“grunt-contrib-watch”);
grunt.loadNpmTasks(“grunt-contrib-compass”);
grunt.loadNpmTasks(“grunt-contrib-clean”);
grunt.loadNpmTasks('g