找到链接Sails JS with EJS but linker to compile handlebars public templates 它看起来很直接,但不知怎的,它不适用于我当前的 Jade sails 版本
这是tasks/config/emberTemplates.js中当前的Grunt配置
module.exports = function (grunt) {
grunt.config.set('emberTemplates', {
dev: {
compile: {
options: {
amd: true,
templateBasePath: /assets\/templates\//
},
files: {
".tmp/public/templates.js": ['assets/templates/**/*.hbs']
}
}
}
});
//console.log('loading grunt-ember-template');
grunt.loadNpmTasks('grunt-ember-templates');
};
我可以看到该任务被 Grunt 接管
> sails lift --prod
.....
Grunt :: Running "emberTemplates:dev" (emberTemplates) task
但是文件 ./tmp/public/templates.js 永远不会被创建。
我把头撞在墙上8个小时,不知道该去哪里。 任何帮助表示赞赏。 谢谢
最佳答案
问题是 dev: 部分..一旦我删除了 dev: 部分,它就起作用了:
module.exports = 函数(grunt){
grunt.config.set('emberTemplates', {
compile: {
options: {
amd: false,
templateBasePath: /assets\/templates\//
},
files: {
".tmp/public/templates.js": ['assets/templates/**/*.hbs']
}
});
grunt.loadNpmTasks('grunt-ember-templates');
};
关于Sails.js、Ember、Handlebars 和通过 grunt-ember-templates 进行的配置 : templates file not created,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25983012/