因此,我一直在尝试Gulp,看看它在速度上与Grunt相比如何,我对结果印象深刻,但是我有一件事我不知道如何在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有可能发生这种情况吗?