javascript - Minified all images - Grunt -
i have more 100 images in images/
folder.
here imagemin - grunt config
// following *-min tasks produce minified files in dist folder imagemin: { dist: { files: [{ expand: true, cwd: '<%= config.app %>/images', src: '{,*/*/}*.{gif,jpeg,jpg,png,ico}', dest: '<%= config.dist %>/images' }] } }
when run grunt build
saw
running "imagemin:dist" (imagemin) task minified 7 images (saved 492.79 kb)
only 7 of images got minified. not all. i've tried changing *
around in diff combination, far - no luck.
src: '{,*/*/}*.{gif,jpeg,jpg,png,ico}'
how fix src
minified everything in images folder ?
i think problem might in src
globbing pattern. pattern using matches images in cwd
root or in 2 levels deep ones ({,*/*/}
).
if want images in cwd
directory minified regardless levels of subdirectories reside, should use **/*
globbing pattern instead:
imagemin: { dist: { files: [{ expand: true, cwd: '<%= config.app %>/images', src: '**/*.{gif,jpeg,jpg,png,ico}', dest: '<%= config.dist %>/images' }] } }
Comments
Post a Comment