我正在使用两个单独的 gulp 任务将模板缩小为 js 文件(1)并将项目的所有 js 文件连接到唯一的缩小文件(2)。
gulp.task('templates', function() { // RESULT of this task
return gulp.src('templates/**/*.html')
.pipe(dotify({
root : 'templates'
}))
.pipe(concat('templates.js'))
.pipe(gulp.dest('js'));
});
gulp.task('minifyJs', ['templates'], function() {
return gulp.src([
'js/templates.js',
'js/plugins/*.js',
'js/*.js'
])
.pipe(concat('scripts-all.js'))
});
问题是:我是否能够通过处理从第一个任务到第二个任务的结果来避免创建 templates.js 文件,以便将它与其余的 js 连接起来?