【发布时间】:2015-09-07 15:50:54
【问题描述】:
我正在尝试复制这样的结构:
src
|-a
|-b
|-c
||-ca
||-cb
dest
|-a
|-b
|-c
||-ca
||-cb
但是,如果 src 目录本身没有出现在 dest 目录中,我似乎无法完成此操作。即
src
|-a
|-b
|-c
||-ca
||-cb
dest
|src
||-a
||-b
||-c
|||-ca
|||-cb
我的副本配置是这样设置的:
files: [
{src: [targetDirectory+"index.html"], dest: buildDirectory, expand: true},
{src: [targetDirectory+"*.png"], dest: buildDirectory, expand: true},
{src: [targetDirectory+minJSDestination], dest: buildDirectory, expand: true},
{src: [targetDirectory+minCSSDestination], dest: buildDirectory, expand: true},
{src: [targetDirectory+"assets/fonts/**.*"], dest: buildDirectory, expand: true},
{src: [targetDirectory+"assets/images/**.*"], dest: buildDirectory, expand: true},
{src: [targetDirectory+"assets/partials/**.*"], dest: buildDirectory, expand: true},
{src: [targetDirectory+"src/*.js"], dest: buildDirectory, expand: true}
]
我尝试了 flatten 选项,该选项从 dest 中删除“src”目录,但它也删除了其他目录并将每个文件放在 dest 的根级别。
我尝试将 'cwd' 设置为目标目录和源目录,但这似乎只是阻止了复制。
我确定必须有一个选项允许这样做,但我还没有找到它。有人有什么想法吗?
【问题讨论】:
标签: javascript gruntjs grunt-contrib-copy