zhaohe
zhaohe

Reputation: 1

gulp-imagemin does not work

I want to compress the images and pipe to the directory of dist,but the dist is empty after run the task. this is my task

gulp.task("minify_img", function() {
  gulp.src("src/img/*")
    .pipe(imagemin())
    .pipe(gulp.dest("/dist/img"));
});

Upvotes: 0

Views: 2620

Answers (2)

huss
huss

Reputation: 11

Try this:

return gulp.src("src/img/*");

Upvotes: 1

Nhan
Nhan

Reputation: 3895

With your current destination path /dist/img, the files will be at the root of your drive (e.g. D:/dist/img). You should add a dot before it, then the files will be exported to the root of your project.

.pipe(gulp.dest("./dist/img"));

Upvotes: 0

Related Questions