grunt配置-copy任务
程序员文章站
2024-01-22 13:33:10
...
copy任务配置项使用示例:
flatten:设置(true、false)用来指定是否保持文件目录结构
那么配置为如下任务
执行 grunt copy:dev就将app目录下所有的html文件都复制到app/test123目录下
https://github.com/gruntjs/grunt-contrib-copy
http://blog.sina.com.cn/s/blog_79c02b6b0102v03e.html
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目录下
https://github.com/gruntjs/grunt-contrib-copy
http://blog.sina.com.cn/s/blog_79c02b6b0102v03e.html