所以我一直在尝试使用Gulp来比较它与Grunt在速度方面的差异,我对结果感到非常印象深刻,但我有一个我不知道如何在Gulp中完成的任务。
所以我有这个gulp任务来压缩HTML:
gulp.task('html-minify', function() {
var files = [
relativePaths.webPath + '/*.html',
relativePaths.webPath + '/components/**/*.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();
return 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));
});
buildMetaData对象具有我需要的自定义功能,这就是为什么我不能使用像gulp-changed这样的插件。 我正在尝试弄清楚的是如何(如果可能的话)在压缩完成处理所有文件并成功运行后运行一块代码。 使用gulp是否可能实现这样的功能?