Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1287 from pixelbrad/master
Browse files Browse the repository at this point in the history
Fix image watcher copying images + reloading browser. Bump gulp-imagemin to 4.1.0.
  • Loading branch information
olefredrik committed Jun 26, 2018
2 parents 7070c2d + ff63245 commit 7928c55
Show file tree
Hide file tree
Showing 3 changed files with 2,979 additions and 2,743 deletions.
23 changes: 18 additions & 5 deletions gulpfile.babel.js
Expand Up @@ -161,9 +161,23 @@ gulp.task('webpack:watch', webpack.watch);
// In production, the images are compressed
function images() {
return gulp.src('src/assets/images/**/*')
.pipe($.if(PRODUCTION, $.imagemin({
progressive: true
})))
.pipe($.if(PRODUCTION, $.imagemin([
$.imagemin.jpegtran({
progressive: true,
}),
$.imagemin.optipng({
optimizationLevel: 5,
}),
$.imagemin.gifsicle({
interlaced: true,
}),
$.imagemin.svgo({
plugins: [
{cleanupAttrs: true},
{removeComments: true},
]
})
])))
.pipe(gulp.dest(PATHS.dist + '/assets/images'));
}

Expand Down Expand Up @@ -229,8 +243,7 @@ function watch() {
gulp.watch('**/*.php', reload)
.on('change', path => log('File ' + colors.bold(colors.magenta(path)) + ' changed.'))
.on('unlink', path => log('File ' + colors.bold(colors.magenta(path)) + ' was removed.'));
gulp.watch('src/assets/images/**/*', gulp.series(images, browser.reload));
gulp.watch('src/assets/images/**/*.svg', gulp.series(copy, browser.reload));
gulp.watch('src/assets/images/**/*', gulp.series(images, reload));
}

// Build the "dist" folder by running all of the below tasks
Expand Down

0 comments on commit 7928c55

Please sign in to comment.