外部项目根目录的Grunt复制目录?

时间:2015-03-23 16:12:23

标签: gruntjs copy

我设法将某些东西从项目复制到其父目录,但没有其他方式复制

/themes/next/less/STUFF <- from
/themes/sym/Gruntfile.js
/themes/sym/target2/STUFF <- to (keep folder structure of source)

copy: {
  fonts: {
    cwd: '..',
    expand: true,
    src: './next/less/**',
    dest: './target2/'
  }
},

我设法复制了STUFF,但这样在next内创建了一个target2文件夹......我不希望这样。

我想要的就像我会从根sym目录

那样做

cp -R ../next/less/. target2

我尝试使用.作为cwd并让它完全忽略dest并将next文件夹放在根目录中。

1 个答案:

答案 0 :(得分:0)

要将所有文件展平为单个文件夹,请将flatten: truefilter:'isFile'一起使用

copy: {
  fonts: {
    cwd: '..',
    expand: true,
    flatten: true,
    src: './next/less/**',
    dest: './target2/STUFF'
    filter: 'isFile'
  }
}

参考Flattening the filepath output @ github.com/grunt-contrib-copy

相关问题