title: Gulp - Run tasks once per folder
body: <p>I'm using Gulp to automate the production of banner ads. I have a list of folders (<code>project.banners</code>) and a set of tasks that should be <strong>run on each folder</strong>. </p>
  
  <p>With my limited knowledge of Gulp I can not figure out how to do this automatically. For now I have to manually update the <code>var banner</code> to point to one particular folder. </p>
  
  <p>I know there are several similar questions on StackOverflow, but could not find anyone that fit or solved my problem, and my trials with a forEach loop has only resulted in errors.</p>
  
  <p>Example:</p>
  
  <pre><code>// Settings
  var project = {
      title       : "Client - Project",
      devPath     : "dev/client/banner/", 
      banners : [
          "180x500",
          "580x400",
          "468x468"
      ]
  }
  
  // Choose which banner/folder to Gulp (should be set by a loop!!?)
  var banner = project.banners[0]; 
  
  // Run tasks
  gulp.task('default', function(callback) {
      runSequence(
          'css', 
          'html',
          'zip',
          callback
      );
  });
  
  // Example task
  gulp.task('css', function() {
    return gulp.src(devPath + banner + '/style.css')   
      .pipe(minifycss())
      .pipe(gulp.dest('dist/temp/' + banner + '/'))
  });
  </code></pre>