I need a progress bar in CLI when I run any task with gulp

511 Views Asked by At

I'm running image optimization via Gulp which taking about a minute to optimize all my images. So can I show a progress bar in CLI so that It displays a progress bar while the image optimization task is running.

here is my code for gulp (which does image optimization)

// compresss image
gulp.task('compress-img', function() {
  gulp.src('src/images/*')
  timer
  .pipe(imagemin([
    imagemin.gifsicle({interlaced: true}),
    imagemin.jpegtran({progressive: true}),
    imagemin.optipng({optimizationLevel: 5}),
    imagemin.svgo({
      plugins: [
        {removeViewBox: true},
        {cleanupIDs: false}
      ] 
    })
  ]))
  .pipe(gulp.dest('dist/images'));
});
1

There are 1 best solutions below

0
Toma Nistor On

You might find these npm packages useful for implementing progress bars: