Skip to content

Commit

Permalink
Fix image glob
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnCuppens committed Feb 21, 2020
1 parent 6d00c35 commit d146988
Show file tree
Hide file tree
Showing 7 changed files with 277 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/gulp/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ function imgCompile({src, dest, browserSync = false}) {
const plugins = (() => {
switch (extension) {
case 'gif':
return imagemin.gifsicle({interlaced: true});
return [imagemin.gifsicle({interlaced: true})];
case 'png':
return imagemin.optipng({optimizationLevel: 5});
return [imagemin.optipng({optimizationLevel: 5})];
case 'svg':
return imagemin.svgo({
return [imagemin.svgo({
plugins: [
{
removeViewBox: false,
collapseGroups: true
}
]
});
})];
case 'jpg':
case 'jpeg':
return imagemin.mozjpeg({progressive: true});
return [imagemin.mozjpeg({progressive: true})];
default: // Required for backwards compatibility with <= v0.3.1
return [
imagemin.gifsicle({interlaced: true}),
Expand All @@ -77,7 +77,7 @@ function imgCompile({src, dest, browserSync = false}) {

stream = stream.pipe(newer(dest))
.pipe(
imagemin([plugins], {
imagemin(plugins, {
silent: true
})
);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"lint": "xo",
"test-default": "cd test/default && node ../../bin/buildozer build",
"test-css": "cd test/css && node ../../bin/buildozer build",
"test-img": "cd test/img && node ../../bin/buildozer build",
"test-env": "cd test/env && node ../../bin/buildozer build --env=development",
"test-copy": "cd test/copy && node ../../bin/buildozer build",
"test-sass-module": "cd test/sass-module && node ../../bin/buildozer build",
Expand Down
8 changes: 8 additions & 0 deletions test/img/.buildozerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
src_base_path: ./
dest_base_path: ./
img:
- src: img/**/*.{png,jpg,jpeg,gif,svg}
dest: dest/img
js: []
js-concat: []
svg-sprite: []
Binary file added test/img/dest/img/test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/img/dest/img/test.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/img/img/test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
261 changes: 261 additions & 0 deletions test/img/img/test.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d146988

Please sign in to comment.