gulp任务的第二个参数是什么意思:

alp*_*rim 3 gulp

我正在寻找一个答案,不必深入或详细.只想知道任务序列究竟发生了什么.

gulp.task('name',['*this right here*'], function() {
    // content
});
Run Code Online (Sandbox Code Playgroud)

是否意味着连续执行此任务,即使用此定义任务?为什么这对我来说是因为在我的gulpfile.js中我使用gulp -inject用于app文件和wiredep用于供应商依赖.如果这是错误的,或者任何一个都会做得很好,我不会留下印象.我到目前为止的内容如下.

//originally i didn't have bower here in the array in 2nd param.
gulp.task('index', ['bower'], function() {
  var target = gulp.src(files.app_files.target);
  var sources = gulp.src(files.app_files.sources, {
    read: false
  });

  return target.pipe(inject(sources))
    .pipe(gulp.dest('./dist'));
});


gulp.task('bower', function() {
  return gulp
    .src(files.app_files.target)
    .pipe(wiredep())
    .pipe(gulp.dest('dist/'));
});


<head>
  <meta charset="UTF-8">
  <title>Example Page</title>
  <!-- Vendor Files  -->
  <!-- bower:css -->
  <!-- endbower -->
  <!-- App Files -->
  <!-- inject:css -->
  <!-- endinject -->
</head>

<body>
  <navigation></navigation>
  <div ui-view></div>
  <footer-area></footer-area>
  <!-- Vendor Files -->
  <!-- bower:js -->
  <!-- endbower -->
  <!-- App Files -->
  <!-- inject:js -->
  <!-- endinject -->
</body>
Run Code Online (Sandbox Code Playgroud)

更新

gulp.task('index', function() {
  var target = gulp.src(files.app_files.target);
  // It's not necessary to read the files (will speed up things), we're only after their paths:
  var sources = gulp.src(files.app_files.sources, {
    read: false
  });

  return target
    //here instead of breaking into new task i piped inject and wiredep, works great
    .pipe(inject(sources))
    .pipe(wiredep())
    .pipe(gulp.dest('./dist'));
});
Run Code Online (Sandbox Code Playgroud)

Bru*_*cia 6

这是在您的任务之前运行的一系列任务.另外,请注意那些任务(数组中的所有任务,在您的情况下只有bower)并行运行.

如果你需要一些顺序.考虑gulp-sequence