Open edwinlimlx opened 7 years ago
Your task is not fully correct. There is no need to match file extensions within the img
directory, but I guess if you do want to do it you would need a glob wildcard (*
) in front of the extensions. You're also sourcing the exact same directory twice, since app/img/**/*.{png,jpg,gif,svg}
would already contain app/img/*.{png,jpg,gif,svg}
. Since this would be hardly any different from the default Gulpfile I suggest just using the default task. Unless you wanted to achieve something else? If so please elaborate on that.
Hi,
I have this code, pretty similar to the default gulpfile. However, images get copied over but they aren't optimized. when I drag some images from the dist/img into compression tools like tinypng. It still can be compressed further
gulp.task('images', () => gulp.src([ 'app/img/*/.{png,jpg,gif,svg}', 'app/img/*.{png,jpg,gif,svg}' ]) .pipe($.cache($.imagemin({ progressive: true, interlaced: true, verbose: true }))) .pipe(gulp.dest('dist/img')) .pipe($.size({ title: 'images' })) );