imagemin

PNGs generated with gulp using imageminPngquant + imageminZopfli don't work on MacOS Safari

南楼画角 提交于 2019-12-25 01:49:11
问题 I have the following gulp code for png minification: function images() { return gulp.src([folder.preimages+'/**/*.png']) .pipe(cache(imagemin([ //png imageminPngquant({ speed: 1, quality: [0.95, 1] //lossy settings }), imageminZopfli({ more: true // iterations: 50 // very slow but more effective }) ]))) .pipe(gulp.dest(folder.public_img)); } The end result is a very nicely compressed png with a low file size. It works fine on Edge, Chrome, Firefox, but when I try to open it on MacOS Safari it

gulp-imagemin - how to disregard directory structures?

拟墨画扇 提交于 2019-12-12 06:05:38
问题 I'm using gulp-imagemin in it's basic form gulp.task('image', function() { return gulp.src('./images/*') .pipe(imagemin({ progressive: true, svgoPlugins: [{removeViewBox: false}], use: [pngquant()] })) .pipe(gulp.dest('./build/')); }); My images/ directory looks like images/ logo.png subfolder/ image.png I would like them to output as such: build/ logo.png image.png But they are retaining their folder structure. How can this be achieved? 回答1: I was able to achieve this with gulp-flatten by

Why don't newly added files trigger my gulp-watch task?

霸气de小男生 提交于 2019-11-30 19:08:54
I have a gulp task which uses gulp-imagemin to compress images. When I add new files to this directory I'd like for this task to compress them as well. I read that gulp.watch doesn't trigger on new files and that I should try gulp-watch so I used it like so; gulp.task('images', function() { watch({glob: './source/images/*'}, function (files) { return files .pipe(plumber()) .pipe(imagemin({ progressive: true, interlaced: true })) .pipe(gulp.dest('./www')); }); }); This works the same as gulp.watch on the first run, but when I add a new image to the directory nothing happens. If I overwrite an

Why don't newly added files trigger my gulp-watch task?

不打扰是莪最后的温柔 提交于 2019-11-30 03:49:06
问题 I have a gulp task which uses gulp-imagemin to compress images. When I add new files to this directory I'd like for this task to compress them as well. I read that gulp.watch doesn't trigger on new files and that I should try gulp-watch so I used it like so; gulp.task('images', function() { watch({glob: './source/images/*'}, function (files) { return files .pipe(plumber()) .pipe(imagemin({ progressive: true, interlaced: true })) .pipe(gulp.dest('./www')); }); }); This works the same as gulp