I had the same problem with Gulp as various tasks related to multiple addresses seem difficult or potentially impossible. Also, setting up multiple threads for one task seems inefficient, but I think this is the solution for now.
For my current project, I needed several links to link to various pages. Gulp Starter Change
https://github.com/greypants/gulp-starter
scrolling / checking tasks:
https://github.com/dtothefp/gulp-assemble-browserify/blob/master/gulp/tasks/browserify.js
I used the forEach loop inside the glob module callback:
gulp.task('browserify', function() { var bundleMethod = global.isWatching ? watchify : browserify; var bundle = function(filePath, index) { var splitPath = filePath.split('/'); var bundler = bundleMethod({ // Specify the entry point of your app entries: [filePath], // Add file extentions to make optional in your requires extensions: ['.coffee', '.hbs', '.html'], // Enable source maps! debug: true }); if( index === 0 ) { // Log when bundling starts bundleLogger.start(); } bundler .transform(partialify) //.transform(stringify(['.html'])) .bundle() // Report compile errors .on('error', handleErrors) // Use vinyl-source-stream to make the // stream gulp compatible. Specifiy the // desired output filename here. .pipe(source( splitPath[splitPath.length - 1] )) // Specify the output destination .pipe(gulp.dest('./build/js/pages')); if( index === (files.length - 1) ) { // Log when bundling completes! bundler.on('end', bundleLogger.end); } if(global.isWatching) { // Rebundle with watchify on changes. bundler.on('update', function(changedFiles) { // Passes an array of changed file paths changedFiles.forEach(function(filePath, index) { bundle(filePath, index); }); }); } } // Use globbing to create multiple bundles var files = glob('src/js/pages/*.js', function(err, files) { files.forEach(function(file, index) { bundle(process.cwd() + '/' + file, index); }) }); });
dtothefp Aug 19 '14 at 15:07 2014-08-19 15:07
source share