Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | About

4.7. Compress Images

		
optimizationLevel: 5, //類型:Number  預設:3  取值範圍:0-7(優化等級)
progressive: true, //類型:Boolean 預設:false 無損壓縮jpg圖片
interlaced: true, //類型:Boolean 預設:false 隔行掃瞄gif進行渲染
multipass: true //類型:Boolean 預設:false 多次優化svg直到完全優化
		
		
var imagemin = require('gulp-imagemin');
 
gulp.task('images', function() {
  return gulp.src('src/images/**/*')
    .pipe(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }))
    .pipe(gulp.dest('dist/assets/img'))
    .pipe(notify({ message: 'Images task complete' }));
});