Gruntjs 如何在Grunt任务中将文件夹正确设置为目标路径?

Gruntjs 如何在Grunt任务中将文件夹正确设置为目标路径?,gruntjs,Gruntjs,在我的项目中,我有许多咕噜任务,这些任务应该处理一堆文件并将它们放入一个文件夹中,保持文件夹的结构不变,例如,对于咖啡翻译: /src/*.coffee->/dest/*.js /src/foo/*.coffee->/dest/foo/*.js 我尝试了不同的Grunfile.coffee配置样式,但似乎都不起作用: coffee: compile: files: 'dest/': 'src/**/*.coffe

在我的项目中,我有许多咕噜任务,这些任务应该处理一堆文件并将它们放入一个文件夹中,保持文件夹的结构不变,例如,对于咖啡翻译:

/src/*.coffee->/dest/*.js
/src/foo/*.coffee->/dest/foo/*.js

我尝试了不同的Grunfile.coffee配置样式,但似乎都不起作用:

    coffee:
        compile: 
            files:
                'dest/': 'src/**/*.coffee'
--

--

以上所有内容(在src值前后加括号和不加括号)都会显示“警告:无法写入”dest/“文件(错误代码:EISDIR)。请使用--force继续。”

然而,这一次却被证明是有效的:

    coffee:
        compile:
            expand: yes
            cwd: 'src'
            src: '**/*.coffee'
            dest:  'dest/'
            ext: '.js'
我已经阅读了官方文件,但找不到任何与dest文件夹相关的内容。英语不是我的母语——我是否遗漏了什么

版本:
grunt: 0.4.1 grunt-autoprefixer: 0.1.20130615 grunt-cli: 0.1.9 grunt-contrib: 0.7.0 grunt-contrib-clean: 0.5.0 grunt-contrib-compass: 0.2.0 grunt-contrib-copy: 0.4.1 grunt-contrib-htmlmin: 0.1.3 grunt-contrib-sass: 0.3.0 grunt-contrib-uglify: 0.2.2 grunt-dot-compiler: 0.5.2 grunt-git: 0.1.3 grunt-htmlcompressor: 0.1.8 grunt-iced-coffee: 0.7.0-a grunt-jade: 0.4.0 grunt-shell: 0.3.1 咕噜声:0.4.1 grunt自动刷新器:0.1.20130615 grunt cli:0.1.9 grunt contrib:0.7.0 grunt contrib清洁:0.5.0 格朗特指南针:0.2.0 grunt contrib副本:0.4.1 grunt contrib htmlmin:0.1.3 grunt contrib sass:0.3.0 grunt contrib丑陋:0.2.2 grunt点编译器:0.5.2 grunt吉特:0.1.3 grunt htmlcompressor:0.1.8 咕噜冰咖啡:0.7.0-a 咕噜翡翠:0.4.0 grunt shell:0.3.1执行以下操作:

files: [
  {
    expand: true, 
    cwd: 'src', 
    src: ['**/*.coffee'], 
    dest: 'dest/', 
    ext: '.js'
  }
]

dest
之后应该使用斜杠(虽然没有斜杠可能会起作用),但是
ext
是必要的。

可能重复@SindreSorhus,我想我找到的解决方案是唯一正确的,尽管没有人确认。谢谢你的提示! grunt: 0.4.1 grunt-autoprefixer: 0.1.20130615 grunt-cli: 0.1.9 grunt-contrib: 0.7.0 grunt-contrib-clean: 0.5.0 grunt-contrib-compass: 0.2.0 grunt-contrib-copy: 0.4.1 grunt-contrib-htmlmin: 0.1.3 grunt-contrib-sass: 0.3.0 grunt-contrib-uglify: 0.2.2 grunt-dot-compiler: 0.5.2 grunt-git: 0.1.3 grunt-htmlcompressor: 0.1.8 grunt-iced-coffee: 0.7.0-a grunt-jade: 0.4.0 grunt-shell: 0.3.1
files: [
  {
    expand: true, 
    cwd: 'src', 
    src: ['**/*.coffee'], 
    dest: 'dest/', 
    ext: '.js'
  }
]