使用grunt-contrib-coffee进行目标

时间:2015-04-08 11:57:50

标签: coffeescript gruntjs grunt-contrib-coffee

我在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.

谢谢!

1 个答案:

答案 0 :(得分: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'
      }
    }
  };
};