所以我决定让Grunt试着为我预编译我的模板。我在设置所有东西时遇到了麻烦。下面是我的Gruntfile.js中的内容:
grunt.loadNpmTasks('grunt-ember-templates');
emberTemplates: {
compile: {
options: {
templateBasePath: "templates/",
templateName: function(name) {
return name.replace('_','/');
}
},
files: {
"templates/templates.js": ["templates/*.hbs"]
}
}
}
watch: {
emberTemplates: {
files: 'templates/*.hbs',
tasks: ['emberTemplates', 'livereload']
},
}我相信这是很好的,因为我引用了该文档。我的package.json有开发依赖项。但是,当我尝试do grunt --help时,没有可用的任务出现。
发布于 2014-04-17 16:35:08
以下是需要注意的几点:
我还回答了如何使用多个文件进行模板编译。下面的链接可能是有用的ember hbs templates as separate files
发布于 2014-04-18 13:05:57
所以,事实证明,我并不知道在Gruntfile.js中放置代码的顺序。我本该
https://stackoverflow.com/questions/23116286
复制相似问题