grunt-contrib-copy中有什么“扩展”选项? 这些例子都使用它,但文档没有说明它的function
- 这里是自述文件和示例: https : //github.com/gruntjs/grunt-contrib-copy/blob/master/README.md 。
- 这里是从https://github.com/gruntjs/grunt-contrib-copy/blob/master/tasks/copy.js代码的相关部分(我显然不明白):
 module.exports = function(grunt){
   “严格使用”;
   var path = require('path');
   grunt.registerMultiTask('copy','Copy files。',function(){
     var kindOf = grunt.util.kindOf;
     var options = this.options({
       processContent:false,
       processContentExclude:[]
     });
     var copyOptions = {
      过程:options.processContent,
       noProcess:options.processContentExclude
     };
     grunt.verbose.writeflags(options,'Options');
     var dest;
     var isExpandedPair;
     var tally = {
       dirs:0,
      文件:0
     };
     this.files.forEach(function(filePair){
       isExpandedPair = filePair.orig.expand || 假;
       filePair.src.forEach(function(src){
         if(detectDestType(filePair.dest)==='directory'){
           dest =(isExpandedPair)?  filePair.dest:unixifyPath(path.join(filePair.dest,src));
         } else {
           dest = filePair.dest;
         }
        如果(grunt.file.isDir(src)){
           grunt.verbose.writeln('Creating'+ dest.cyan);
           grunt.file.mkdir(目标);
           tally.dirs ++;
         } else {
           grunt.verbose.writeln('Copying'+ src.cyan +' - >'+ dest.cyan);
           grunt.file.copy(src,dest,copyOptions);
           tally.files ++;
         }
       });
     });
	
展开允许您指定是否要完整地创build目标path(例如: /path/missing1/missing2 ),或者仅在其父目录( /path/existing/missing )存在时创build最后一个目录。 
 由于expand是Grunt的一部分,而不是grunt-contrib-copy的特定信息,所以可以在Grunt的文件configurationAPI中find它的信息: 
将
expand设置为true以启用以下选项:
cwd所有的src匹配都是相对于(但不包括)这个path。
src模式匹配,相对于cwd。- 目的地path前缀。
ext用生成的destpath中的此值replace任何现有的扩展。
extDot用于指示指示分机的时间段位于何处。 可以采用'first'(扩展名在文件名的第一个句点之后开始)或'last'(扩展名在上一个句点之后开始),默认设置为'first'。
flatten从生成的destpath中移除所有path部分。
rename为每个匹配的src文件调用此函数(在扩展名重命名和展平之后)。dest和匹配的srcpath被传入,并且这个函数必须返回一个新的dest值。 如果同一个dest不止一次返回,那么每个使用它的src都会被添加到一个源数组中。
 另外,如果设置expand为true dest好像总是被认为是目标目录。