반응형
grunt-contrib-copy에서“확장”옵션은 무엇을합니까? 예제는 모두 그것을 사용하지만 문서는 그것이하는 일에 대해 아무것도 말하지 않습니다.
- 다음은 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 ++; } }); });
확장을 사용하면 대상 경로를 전체 (예 :)로 만들 것인지 아니면 /path/missing1/missing2
부모가있을 때 마지막 디렉토리 만 만들 것인지 () 지정할 수 있습니다 /path/existing/missing
.
때문에 expand
불평 소리의 일부가 꿀꿀-있는 contrib 복사에 대한 구체적인 아니라,에 대한 정보는에서 찾을 수 있습니다 그런트의 파일 구성 API :
설정
expand
하기 위해true
다음과 같은 옵션을 사용하려면 :
cwd
모든src
일치 항목은이 경로를 기준으로합니다 (포함하지 않음).src
를 기준으로 일치시킬 패턴cwd
입니다.dest
대상 경로 접두사.ext
생성 된dest
경로 에서 기존 확장을이 값으로 바꿉니다 .extDot
Used to indicate where the period indicating the extension is located. Can take either'first'
(extension begins after the first period in the file name) or'last'
(extension begins after the last period), and is set by default to'first'
.flatten
Remove all path parts from generateddest
paths.rename
This function is called for each matchedsrc
file, (after extension renaming and flattening). Thedest
and matchedsrc
path are passed in, and this function must return a newdest
value. If the samedest
is returned more than once, eachsrc
which used it will be added to an array of sources for it.
Additionally it seems like dest
will always be considered to be a destination directory if setting expand
to true
.
반응형
'program story' 카테고리의 다른 글
Godaddy 도메인을 AWS Elastic Beanstalk 환경과 연결하는 방법은 무엇입니까? (0) | 2020.08.22 |
---|---|
Java HashMap 성능 최적화 / 대안 (0) | 2020.08.22 |
Java와 C / C ++ 간의 프로세스 간 통신을위한 가장 빠른 (낮은 지연) 방법 (0) | 2020.08.22 |
String (& String), Vec (& Vec) 또는 Box (& Box)에 대한 참조를 함수 인수로 받아들이지 않는 이유는 무엇입니까? (0) | 2020.08.22 |
Node.js에서 여러 콜백을 기다리는 관용적 방법 (0) | 2020.08.22 |