title: How do you run a gulp "on end" task but only at the end of the current task?
body: <p>I'm using Gulp to collect front-matter (via gulp-front-matter plugin) and then, after aggregating it, I'm saving it into another file. Among other data, I'm saving a bunch of CSS. Here's what I have for my <code>compileCSS</code> task:</p>
  
  <pre><code>var collected = [];
  
  gulp.src('./client/**/*.html')
    .pipe(frontMatter({ property: 'meta', remove: true }))
    .pipe(through.obj(function(file, enc, callback) {
         var css = file.meta;
         collected.push(css);
     }))
     .pipe(gulp.dest('./build/templates'))
     .on('end', function() {
         var cssPath = ['build', 'assets', 'css', 'compiled.css'];
         fs.writeFileSync(cssPath.join(path.sep), cssPath);
     })
  </code></pre>
  
  <p>;</p>
  
  <p>The task works as expected (note, it's a simplified version). Everything works as expected and I get a <code>compiled.css</code> file with all of the front-matter CSS. However, I found a need to use the Prefixer not only on my regular css file but on this new compiled.css as well. So I created a <code>prefix</code> task:</p>
  
  <pre><code>gulp.task('prefix', ['compileCSS', 'copy'], function() {
      gulp.src('./build/assets/css/*.css')
          .pipe(autoprefixer({ browsers: ['last 3 versions'] }))
          .pipe(gulp.dest('build'))
      ;
  });
  </code></pre>
  
  <p>Now, the problem is that the <code>on('end'</code> function runs at the end of ALL the tasks, not just the <code>compileCSS</code> task. </p>
  
  <p>My question is, is there a way to inject an "on end" type task for each task? Or is there a way to use streams somehow (since the last task isn't an actual stream and doesn't take advantage of it, I don't see how).</p>