Coffeescript Glob To Multiple with multiple cwd and dest

时间:2015-03-30 10:08:26

标签: coffeescript gruntjs

我在gruntfile.js

中有这样的CoffeeScript配置
coffee: {
  glob_to_multiple: {
      expand: true,
      flatten: false,
      cwd: 'server/api',
      src: ['**/*.coffee'],
      dest: 'server/api',
      ext: '.js',
      extDot: 'last'
  }
}

我想添加另一个目录,例如cwd: 'server/config'和目的地应分别为dest: 'server/config'。如何实现?

1 个答案:

答案 0 :(得分:1)

定义另一个咖啡子任务:

coffee: {
  glob_to_multiple: {
      expand: true,
      flatten: false,
      cwd: 'server/api',
      src: ['**/*.coffee'],
      dest: 'server/api',
      ext: '.js',
      extDot: 'last'
  },

  other_stuff: {
    expand: true,
    flatten: false,
    cwd: 'server/config',
    src: ['**/*.coffee'],
    dest: 'server/api',
    ext: '.js',
    extDot: 'last'
  }
}

grunt coffee会执行这两项任务,grunt coffee:glob_to_multiple只会运行第一项任务。