我的文件夹结构是这样的
我想将文件夹img/
从src/
复制到dist/
文件夹。
我使用以下 grunt 命令,使用 grunt-contrib-copy :
copy:{
main : {
files : [
{
flatten : true,
expand: true,
src: ['src/img/*'],
dest: 'dist/img'
}
]
}
}
但我的文件夹结构最终是这样的。缺少图标文件夹中的图像:
基本上,我想执行 linux 命令(当我位于项目的根目录时):
cp -r src/img dist/img
我该怎么做?
最佳答案
将 flatten 设置为 false flatten : false
并将 src 更改为 ['src/img/**']
以包含子目录(来源:https://github.com/gruntjs/grunt-contrib-copy)
copy:{
main : {
files : [
{
flatten : false,
expand: true,
src: ['src/img/**'],
dest: 'dist/img'
}
]
}
}
关于node.js - 使用 grunt-contrib-copy 将文件夹结构从 src/复制到 dist/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30071985/