@@ -17,7 +17,7 @@ const postcssImport = require('postcss-import')
1717const postcssUrl = require ( 'postcss-url' )
1818const postcssVar = require ( 'postcss-custom-properties' )
1919const { Transform } = require ( 'stream' )
20- const map = ( transform ) => new Transform ( { objectMode : true , transform } )
20+ const map = ( transform = ( file , enc , next ) => next ( ) ) => new Transform ( { objectMode : true , transform } )
2121const uglify = require ( 'gulp-uglify' )
2222const vfs = require ( 'vinyl-fs' )
2323
@@ -106,14 +106,16 @@ module.exports = (src, dest, preview) => () => {
106106 vfs
107107 . src ( 'img/**/*.{gif,ico,jpg,png,svg}' , opts )
108108 . pipe (
109- imagemin (
110- [
111- imagemin . gifsicle ( ) ,
112- imagemin . jpegtran ( ) ,
113- imagemin . optipng ( ) ,
114- imagemin . svgo ( { plugins : [ { removeViewBox : false } ] } ) ,
115- ] . reduce ( ( accum , it ) => ( it ? accum . concat ( it ) : accum ) , [ ] )
116- )
109+ preview
110+ ? map ( )
111+ : imagemin (
112+ [
113+ imagemin . gifsicle ( ) ,
114+ imagemin . jpegtran ( ) ,
115+ imagemin . optipng ( ) ,
116+ imagemin . svgo ( { plugins : [ { removeViewBox : false } ] } ) ,
117+ ] . reduce ( ( accum , it ) => ( it ? accum . concat ( it ) : accum ) , [ ] )
118+ )
117119 ) ,
118120 vfs . src ( 'helpers/*.js' , opts ) ,
119121 vfs . src ( 'layouts/*.hbs' , opts ) ,
0 commit comments