I have a gulp task called build that uses sub-tasks to move various parts of my source to a build folder:
gulp.task('build', ['jshint', 'templates', 'app', 'components', 'stylesheets', 'assets', 'index']);
gulp.task('app', ['clean-app'], function(){
return gulp.src(config.inputs.app)
.pipe(gulp.dest(config.outputs.root));
});
I then wanted to add some extra steps when --env=prod, which I did with gulp-if:
gulp.task('app', ['clean-app'], function(){
return gulp.src(config.inputs.app)
**.pipe(gulpif(env === 'prod', uglify()))**
.pipe(gulp.dest(config.outputs.root));
});
This works fine. The final thing I want to do is to gulp-concat all the js files from those sub-tasks. I figure that I can use gulpif to return a stream from each task instead of going to gulp.dest, but I would still need to somehow conditionally run a task to combine those streams and concat.
Is there a better way to do this?