Sails.js、Ember、Handlebars 和通过 grunt-ember-templates 进行的配置 : templates file not created

标签 sails.js handlebars.js grunt-ember-templates

找到链接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/

相关文章:

javascript - 使用 Handlebars.js 渲染本地模板

templates - Uncaught Error : Template was precompiled with an older version of Handlebars

javascript - 无法将最新的 ember 与预编译模板一起使用

node.js - 使用 sails.js 和 sails-postgresql 的数据库模式

mysql - 当我将 sails js 连接到 mysql 时出现错误( Node - v7.5.0)

javascript - 从 2 个数组渲染表格

ember.js - 给定数据模板名称的匹配模板名称是什么

node.js - Sails.js:如何在 assets/js/files.js 中使用 i18n 函数

node.js - Sailsjs req.setLocale 外部 Controller

javascript - 如何将事件绑定(bind)到模板/数据绑定(bind)引擎生成的 html(无 Jquery)