copy任务配置项使用示例:
copy: {
main: {
files: [
// includes files within path
{expand: true, src: ['path/*'], dest: 'dest/', filter: 'isFile'},
// includes files within path and its sub-directories
{expand: true, src: ['path/**'], dest: 'dest/'},
// makes all src relative to cwd
{expand: true, cwd: 'path/', src: ['**'], dest: 'dest/'},
// flattens results to a single level
{expand: true, flatten: true, src: ['path/**'], dest: 'dest/', filter: 'isFile'},
],
},
},
flatten:设置(true、false)用来指定是否保持文件目录结构
那么配置为如下任务
copy: {
dev : {
files : [{
expand : true,
cwd : 'app',//根目录
dest : 'test123',
src : '*.html'//基于cwd的子目录
}]
}
}
执行 grunt copy:dev就将app目录下所有的html文件都复制到app/test123目录下
[url]https://github.com/gruntjs/grunt-contrib-copy[/url]
[url]http://blog.sina.com.cn/s/blog_79c02b6b0102v03e.html[/url]
最后
以上就是开放日记本最近收集整理的关于grunt配置-copy任务的全部内容,更多相关grunt配置-copy任务内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复