재귀 적 디렉토리에 포함되지만 현재 디렉토리 내 파일이 다른 포함 된 디렉토리에 파고 전에, 전을 추가 할 수 있음을 보장하는 자바 스크립트 파일 CONCAT 필요 here에서 제시 한 해결책은 재귀 적이 함께 파일을 얻을 수있었습니다 :그런트의 CONCAT 디렉토리 재귀 파일
// get all module directories
grunt.file.expand("src/*").forEach(function (dir) {
// get the module name from the directory name
var dirName = dir.substr(dir.lastIndexOf('/') + 1);
// create a subtask for each module, find all src files
// and combine into a single js file per module
concat.main.src.push(dir + '/**/*.js');
});
console.log(concat.main.src);
을하지만 난 concat.main.src에 검사 할 때 다음 순서는 내가 필요로하는 방식이되지 않습니다 :
//console.log output
['src/module1/**/*.js',
'src/module2/**/*.js',
'src/main.js']
내가 필요로하는 순서는 다음과 같습니다
내가 이것을 달성 할 수있는 방법에 대한 아이디어['src/main.js',
'src/module1/**/*.js',
'src/module2/**/*.js']
?
main.js는 단지 예일뿐입니다. 사실 루트 디렉토리에는 n 개의 파일이 존재할 수 있으며 레벨이 n 일 수도있는 동일한 동작을 보장하는 솔루션을 얻고 싶습니다. 위의 내용은 내가 필요한 것을 설명하기위한 것이지만, 이것이 적절한 해결책이라고 생각하지 않습니다. 어쨌든 많은 감사합니다 !!! – YadirHB