【问题标题】:Target using grunt-contrib-coffee使用 grunt-contrib-coffee 定位
【发布时间】:2015-06-13 08:53:44
【问题描述】:

我在 AngularJS 项目中使用grunt-contrib-coffee,我正在尝试根据 grunt 的目标设置配置选项。我有以下配置文件(使用grunt-load-options):

'use strict';

module.exports = function(grunt) {
  return {
    stage: {
      glob_to_multiple: {
          expand: true,
          nonull: true,
          cwd: 'src/js/',
          src: ['*.coffee', 'config/stage.coffee'],
          dest: '.tmp/js/',
          ext: '.js'
      }
    }
  };
};

但是当我使用grunt coffee:stage 执行任务时,没有文件被复制。有什么想法吗?

Running "coffee:stage" (coffee) task
>> 0 files created.

Done, without errors.

谢谢!

【问题讨论】:

  • 您确定配置文件的名称正确吗?在这种情况下coffee.js?
  • 运气好吗?
  • 是的,正确命名。

标签: coffeescript gruntjs grunt-contrib-coffee


【解决方案1】:

grunt-config-coffee 的正确配置需要以 coffee 开头,然后根据您的情况使用特定配置(使用 stage 而不是 glob_to_multiple):

module.exports = function(grunt) {
  return {
    coffee: {
      stage: {
          expand: true,
          nonull: true,
          cwd: 'src/js/',
          src: ['*.coffee', 'config/stage.coffee'],
          dest: '.tmp/js/',
          ext: '.js'
      }
    }
  };
};

【讨论】:

  • 我仍然收到错误消息:正在运行“coffee:stage”(咖啡)任务正在验证配置中存在的属性 coffee.stage...错误 >> 无法处理任务。警告:缺少必需的配置属性“coffee.stage”。使用 --force 继续。由于警告而中止。
猜你喜欢
  • 2013-07-22
  • 2014-02-25
  • 2013-02-11
  • 1970-01-01
  • 2015-12-24
  • 2015-01-25
  • 1970-01-01
  • 2013-02-16
  • 2013-12-28
相关资源
最近更新 更多