D
D
Dmitry Belyaev2014-01-24 16:07:08
Images
Dmitry Belyaev, 2014-01-24 16:07:08

When running Gulp, how to save processed files in the same place where they came from?

Colleagues, I ask you.
There is a code whose task is to shrink images in folders. With automatic penetration into subfolders.

var gulp = require('gulp');
var imagemin = require('gulp-imagemin');

gulp.task('default', function () {
    gulp.src('images/**/*')
    .pipe(imagemin())
    .pipe(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }))
    .pipe(gulp.dest(?????))
});

How to make optimized images simply overwritten?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Velichko, 2014-03-19
@Zoxon

gulp.task('images', function() {
  gulp.src('./images/**/*.{jpg,jpeg,png,gif}')
    .pipe(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }))
    .pipe(gulp.dest('./images'))
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question