Skip to content

Commit

Permalink
filtering gulp.src base directories for image glob
Browse files Browse the repository at this point in the history
This fixed google#579.  Somewhat recently, the gulp-cache repository made some changes that made sending files not easily managed by gulp-cache a much simpler pill to swallow.  That's definitely changing (they're fixing problems, to be clear) and short of a simple gulp.src nodir+follow option, using the included gulp-if plugin to drop out of the file stream the base directories makes the gulp file work super smoothly.  Hope it helps!
  • Loading branch information
pavgup committed Feb 22, 2015
1 parent 69946bd commit a08bab7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ gulp.task('jshint', function () {
.pipe($.if(!browserSync.active, $.jshint.reporter('fail')));
});

// Optimize Images
// Optimize Images Recursively (All Files)
gulp.task('images', function () {
return gulp.src('app/images/**/*')
.pipe($.cache($.imagemin({
.pipe($.if($.if.isFile,$.cache($.imagemin({
progressive: true,
interlaced: true
})))
}))
.on('error', function(err){ console.log(err); this.end; })))
.pipe(gulp.dest('dist/images'))
.pipe($.size({title: 'images'}));
});
Expand Down

0 comments on commit a08bab7

Please sign in to comment.