Skip to content

Commit

Permalink
feat(image): added image optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
HoseaCodes committed Sep 3, 2021
1 parent e9fe8c9 commit 8d1f0d8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions config/imageOp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import imagemin from 'imagemin';
import imageminJpegtran from 'imagemin-jpegtran';
import imageminPngquant from 'imagemin-pngquant';

const imageOp = (async () => {
try {
const files = await imagemin(['images/*.{jpg,png}'], {
destination: 'build/static/media',
plugins: [
imageminJpegtran(),
imageminPngquant({
quality: [0.6, 0.8]
})
]
});
} catch (err) {
logger.error(err);
}
})

export { imageOp };

0 comments on commit 8d1f0d8

Please sign in to comment.