在Ember.js中预编译模板

我正在创build一个带有Node后端的Ember项目,并希望将我的模板作为单独的文件,而不是将它们内联在index.html文件中。 我已经阅读了很多文章解释这一点,但是我仍然无法把头脑包裹在整个过程中,以及index.html文件等等什么时候完成。 咕噜是最有效的做这样的事情? 这是我的grunt文件的样子。

Gruntfile.js:

grunt.loadNpmTasks('grunt-ember-templates'); grunt.registerTask('build', ['emberTemplates', 'concat', 'uglify']); //pass the compiled templates into your concat and uglify tasks. Don't worry, they don't care if they are mushed altogether // with the following task in the Grunt.config emberTemplates: { compileComponents: { options: { templateBasePath: /templates\// }, files: { 'build/precompile/components.js': 'templates/components/*.hbs' } }, compileRoutes: { options: { templateBasePath: /templates\/routes\// }, files: { 'build/precompile/routes.js': ['templates/routes/*.hbs', 'templates/routes/**/*.hbs'] } }, compilePartials: { options: { templateBasePath: /templates\/partials\// }, files: { 'build/precompile/partials.js': 'templates/partials/*.hbs' } }, compileSubstates: { options: { templateBasePath: /templates\/substates\// }, files: { 'build/precompile/substates.js': 'templates/substates/*.hbs' } }, compileViews: { options: { templateBasePath: /templates\/views\// }, files: { 'build/precompile/views.js': 'templates/views/*.hbs' } } }