I'm wondering if there's any way to combine these two separate tasks into one.
This concat-js
task requires a generated file to exist prior to running. The task cache-angular-templates
generates that file. The generated file needs to be included in the concat
output. After concat-js
is done, the file can be deleted—it isn't needed anymore.
It seems to be that I should somehow be able to pipe in the stream used in cache-angular-tempaltes
into the stream concat-js
uses.
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))
;
});