I tried earlier answers, but I got an endless loop because I did not ignore files that were already rated.
First use this code, similar to the other answers:
//setup minify task var cssMinifyLocation = ['css/build/*.css', '!css/build/*.min.css']; gulp.task('minify-css', function() { return gulp.src(cssMinifyLocation) .pipe(minifyCss({compatibility: 'ie8', keepBreaks:false})) .pipe(rename({ suffix: '.min' })) .pipe(gulp.dest(stylesDestination)); });
Note the '!css/build/*.min.css' in src (i.e. var cssMinifyLocation)
//Watch task gulp.task('default',function() { gulp.watch(stylesLocation,['styles']); gulp.watch(cssMinifyLocation,['minify-css']); });
You must ignore the thumbnail files in both the watch and the task.
bbuie Oct 22 '15 at 23:01 2015-10-22 23:01
source share