7
이 두 가지 작업을 하나로 결합하는 방법이 있는지 궁금합니다.여러 개의 src 스트림을 꿀꺽 꿀꺽하게 결합 하시겠습니까?
이 concat-js
작업에는 실행하기 전에 생성 된 파일이 있어야합니다. cache-angular-templates
작업은 해당 파일을 생성합니다. 생성 된 파일은 concat
출력에 포함되어야합니다. concat-js
이 완료되면 파일을 삭제할 수 있습니다. — 더 이상 필요하지 않습니다.
어떻게 든 사용해야하는 것으로 보입니다. 스트림에서 을 사용하여 cache-angular-tempaltes
에 사용 된 스트림에서 사용할 수 있습니다.
gulp.task('concat-js', ['cache-angular-templates'], function() {
var concatOutputPath = path.dirname(paths.compiledScriptsFile),
concatOutputFileName = path.basename(paths.compiledScriptsFile),
jsFiles = [].concat(
paths.libScripts,
paths.appScripts,
paths.templateScriptFile,
notpath(paths.compiledScriptsFile),
notpath(paths.specMockScripts),
notpath(paths.specScripts)
);
return gulp
.src(jsFiles)
.pipe(buildTools.concat(concatOutputFileName))
.pipe(gulp.dest(concatOutputPath))
.on('end', function() {
del(paths.templateScriptFile);
})
;
});
gulp.task('cache-angular-templates', function() {
var cacheOutputPath = path.dirname(paths.templateScriptFile),
cacheOutputFileName = path.basename(paths.templateScriptFile);
var options = {
root: '/' + cacheOutputPath,
standalone: true,
filename: cacheOutputFileName
};
return gulp
.src(paths.templates)
.pipe(buildTools.angularTemplatecache(options))
.pipe(gulp.dest(cacheOutputPath))
;
});
굉장! 정말 고맙습니다! 이것은 내가 찾고 있었던 바로 그 것이다. 나는 내가하고있는 일을 내가해야하는지 여부에 가지 않았기 때문에 기쁘다. 나는 단지 그것을 필요로 할 때 적용 할 패턴이있는 방법을 알고 싶었다. 다시 한 번 감사드립니다! – core
+1 일반적으로 나에게 적합한 솔루션에 대해서는 언급하지 않지만 지난 6 시간 동안 인터넷 검색 및 독서 문서를 보내 여러 개의 gulp.src 호출을 병합하는 방법을 알아 냈습니다. 이것이 내가 발견 한 유일한 것입니다. 작업. 뛰어난 답변! –
위와 동일합니다. 이벤트 스트림 병합과 병합 스트림 패키지가 약간 미묘하지만 크게 다른 것을 혼란스럽게합니다. 문서화 주셔서 감사합니다! – RobW