这是一个组合任务,我不知道如何用任务依赖项替换它.
Here is a composed task I don't know how to replace it with task dependencies.
...
gulp.task('watch', function () {
var server = function(){
gulp.run('jasmine');
gulp.run('embed');
};
var client = function(){
gulp.run('scripts');
gulp.run('styles');
gulp.run('copy');
gulp.run('lint');
};
gulp.watch('app/*.js', server);
gulp.watch('spec/nodejs/*.js', server);
gulp.watch('app/backend/*.js', server);
gulp.watch('src/admin/*.js', client);
gulp.watch('src/admin/*.css', client);
gulp.watch('src/geojson-index.json', function(){
gulp.run('copygeojson');
});
});
对应的变更日志https://github.com/gulpjs/gulp/blob/master/CHANGELOG.md#35 [弃用 gulp.run]
The corresponding changelog https://github.com/gulpjs/gulp/blob/master/CHANGELOG.md#35 [deprecate gulp.run]
gulp.task('watch', function () {
var server = ['jasmine', 'embed'];
var client = ['scripts', 'styles', 'copy', 'lint'];
gulp.watch('app/*.js', server);
gulp.watch('spec/nodejs/*.js', server);
gulp.watch('app/backend/*.js', server);
gulp.watch('src/admin/*.js', client);
gulp.watch('src/admin/*.css', client);
gulp.watch('src/geojson-index.json', ['copygeojson']);
});
您不再需要传递函数(尽管您仍然可以)来运行任务.你可以给 watch 一个任务名称数组,它会为你做这件事.
You no longer need to pass a function (though you still can) to run tasks. You can give watch an array of task names and it will do this for you.
这篇关于gulp.run 已弃用.如何编写任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!