Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// Styles
gulp.task('styles', function() {
return gulp.src(config.sources.styles)
.pipe(sass({ errLogToConsole: true, outputStyle: 'expanded' }))
.pipe(prefix('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulpif(isProduction, mincss({ keepSpecialComments: 0 })))
// Scripts
gulp.task('scripts', function() {
return gulp.src(config.sources.scripts)
.pipe(gulpif(isProduction, uglify()))
// Images
gulp.task('images', function() {
return gulp.src(config.sources.images)
optimizationLevel: 5,
progressive: true,
interlaced: true
// Clean assets
gulp.task('clean', function(cb) {
return gulp.src('./src/assets', {read: false})
// The Gulp 3.5 way, no;
// No guarantee clean will be complete
gulp.task('build', ['clean', 'styles', 'scripts', 'images']);
// The pre-Gulp 3.5 way
// Clean will be complete beforehand
gulp.task('build', ['clean'], function() {'styles', 'scripts', 'images');
* What would be considered best practice for ensuring clean is fully complete
* and finished before running other tasks? I want to be able to run `styles`, `scripts`, `images`
* without depending on `clean` — I only want to clean when then `build` task is executed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.