Here app/folder1/
is containing 3 angularjs files (controller, service, factory). By using 'task1'
, I am combining all html files into 'templates.js'. In 'task2'
, I need to combine 3 angularjs files and 1 templates.js file into single file.
But in 'task2', system is reading only 3 angularjs files. If i run 'task2' separately then system is combining 4 files.
gulp.task('task1',function() {
gulp.src('app/**/*.html')
.pipe(minifyHtml({empty: true}))
.on('error', gutil.log)
.pipe(templateCache({root: 'app/folder1/',module:'myModule'}))
.on('error', gutil.log)
.pipe(gulp.dest('app/folder2/'))
.on('error', gutil.log);
});
});
gulp.task('task2',function(){
var newName = 'script_' + new Date().getTime() + '.js';
gulp.src('app/folder2/**/*.js')
.on('error', gutil.log)
.pipe(concat(newName,{newLine: ';'}))
.on('error', gutil.log)
.pipe(gulp.dest('/dist/'))
.on('error', gutil.log)
.pipe(uglify({mangle:false }))
.on('error', gutil.log)
.pipe(gulp.dest('/dist/'))
.on('error', gutil.log);
});
});
gulp.task('default', function(callback) {
runSequence('task1','task2',callback);
});
If i run gulp
command it is not combining templates.js file.
If i run gulp
, gulp task2
then it is working as expected.
What is the issue?
I believe you need to return the stream if you're not going to handle the callback
within task1
and task2
.
return gulp.src('app/**/*.html')
.pipe(...