Gulp task with different source depending on arguments
You were on the right track with your second try, just needed to utilize a bit of DRY and closures function createTransformTaskClosure (destination) { return function () { return gulp.src(config.sourceJSX) .pipe(gulp.dest(destination)); }; } gulp.task(‘dev’, createTransformTaskClosure(config.output_development)); gulp.task(‘prod’, createTransformTaskClosure(config.output_production));