问题描述
我正在设置一个Grunt脚本,需要将图像的目录从A复制到B,足够简单。
目录结构: 组件 每个img目录都可以包含这些目录中的其他目录和目录,以帮助组织图像。 我想使用Grunt来获取所有这些图像并将其放入他们在一个目录下(assets / img): 关于如何在不指定每个组件的情况下在grunt中执行此操作的任何想法d irectory(它需要完全自动化)? 使用。 只需传递匹配的glob模式(例如 I'm setting up a Grunt script that needs to copy and reorganise directories of images from A to B. Simple enough. Directory structure: components Each img directory could contain other directories and directories within those directories to help organise the images. I want to use Grunt to take all those images and put them under one directory (assets/img): assets Any ideas on how could I do this in grunt without specifying each component directory (it needs to be fully automated)? This is rather simple using Just pass matching glob patterns (e.g. 这篇关于Grunt递归拷贝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
资产
$ b
** / img / **
),然后在返回的匹配文件值上进行复制。grunt.file.expand
.**/img/**
), and then recurse on the returned matching file values to copy.