0
I need minify many images, but I’m not getting with the Gulp.
Problem: The Code minifica no image and I have checked that all images are in the folder.
Folder structure: Gulpfile is at the same level as the img folder and inside the folder has the images inside.
Console:
gulp-imagemin: Minified 0 images
Finished 'minify-img' after 4.06 s
Code:
// gulpfile.js
const gulp = require('gulp');
const imagemin = require('gulp-imagemin');
gulp.task('minify-img', function () {
return gulp.src('img/*')
.pipe(imagemin())
.pipe(gulp.dest('img/'))
});
Expected Result: Minify all images inside the folder img
What appears on the console?
– Valdeir Psr
Gulp-imagemin: Minified 0 images
– Davi Luis
Are you pointing to the right folder? How is the project folder structure?
– Diego Souza
Gulpfile is together with the img folder and inside the folder has the images inside.
– Davi Luis
have you tried other options?
– Ivan Ferrer
see if the image path is correct:
return gulp.src('img/*')
=>return gulp.src('./img/*')
– Ivan Ferrer
if the gulpfile file is inside the folder
img
, it would be this case then:gulp.src('./*')
– Ivan Ferrer
I’ll try other options, but I wanted to know what’s wrong since it seems to be following all the standards of Gulp.
– Davi Luis