2016-06-14 7 views
1

こんにちは私のGulp構成ではイメージ用に少し問題がありますが、gulpタスクはresourcesフォルダー内のすべてのイメージを縮小してからパブリック・ディレクトリーに配置し、しかし、唯一のPNG画像が正しく...私が実行している作業ですSVGイメージでGulpイメージが動作しない

gulp.task('images', function() { 

    gulp.src(assets + 'images/**') 
      .pipe(imagemin({ 
       progressive: true, 
       optimizationLevel: 7, 
       svgoPlugins: [{removeViewBox: false}], 
       use: [pngquant()] 
      })) 
      .pipe(gulp.dest(public + 'images/')); 

}); 

が、私は現在imageminバージョン2.4.0^

答えて

1

を使用していますが、同じ問題を手に入れた輸出されている、ここにあります私の設定:

let developmentAssets = "src", 
    productionAssets = "dist"; 


module.exports = { 
    optimize : { 
    images: { 
     src: developmentAssets + '/img/**/*.{jpg,jpeg,png,gif,svg}', 
     options: { 
      optimizationLevel: 3, 
      progessive: true, 
      interlaced: true 
     } 
     } 
    } 
}; 

その後、あなたのタスクで

/* 
    This is my particular setting to have everything organized 
    read this amazing gulp tutorial: http://stefanimhoff.de/2014/gulp-tutorial-12-optimize-css-javascript-images-and-html/ 
*/ 

config  = require('./gulp/config'), 
configImg = config.optimize.images, 


.pipe(imagemin(configImg.options)) 

は、それが役立つことを願っています。

関連する問題