How to perform multiple gulp commands in one task

…衆ロ難τιáo~ 提交于 2019-12-02 19:18:17

You can pass an array of globs to gulp.src if you are doing the same things to all files. For example,

gulp.task('task1', function () {
  return gulp.src(['src/js/**/*', 'src/css/**/*']).pipe(gulp.dest('dist'));
});

Be sure to return the stream so the orchestrator knows when that task is complete.

If you are doing different things to the different sets of files, you can merge the streams like this in one task:

var es = require('event-stream');
gulp.task('fancy-task', function () {
  return es.merge(
      gulp.src('*.js').pipe(some-js-plugin()),
      gulp.src('*.css').pipe(some-style-plugin))
      .pipe(gulp.dest('dist'));
});
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!