- 다음은 README 및 예제입니다 : 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 : 거짓,
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) === '디렉터리') {
dest = (isExpandedPair)? filePair.dest : unixifyPath (path.join (filePair.dest, src));
} else {
dest = filePair.dest;
}
if (grunt.file.isDir (src)) {
grunt.verbose.writeln ( 'Creating'+ dest.cyan);
grunt.file.mkdir (dest);
tally.dirs ++;
} else {
grunt.verbose.writeln ( 'Copying'+ src.cyan + '->'+ dest.cyan);
grunt.file.copy (src, dest, copyOptions);
tally.files ++;
}
});
});
수락 된 답변이 잘못되었음을 알고 있습니까? 아래 답변을 참조하십시오 .
—
David Pärsson 19 년