您可以根据以下条件完成一项任务
html-minify:
gulp.task('other-task', ['html-minify'], function() { //stuff});您还可以
end在
html-minify任务中监听流事件:
gulp.task('html-minify', function(done) { var files = [ relativePaths.webPath + '*.html', relativePaths.webPath + '/' + relativePaths.appPath + '/components*.html' ]; var changedFiles = buildmetaData.getChangedFiles(files); //TODO: needs to execute only after successful run of the task buildmetaData.addBuildmetaDataFiles(changedFiles); buildmetaData.writeFile(); var stream = gulp.src(changedFiles, { base: relativePaths.webPath }) .pipe(filelog()) .pipe(minifyHtml({ empty: true, quotes: true, conditionals: true, comments: true })) .pipe(gulp.dest(relativePaths.webPath + '/' + relativePaths.appPath + '/' + relativePaths.buildPath)); stream.on('end', function() { //run some pre here done(); }); stream.on('error', function(err) { done(err); });});


