forked from IntelligentQuantum/IntelligentQuantum.GitHub.IO
-
Notifications
You must be signed in to change notification settings - Fork 1
/
images-minifier.js
27 lines (25 loc) · 854 Bytes
/
images-minifier.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const compress_images = require('compress-images');
const INPUT_path_to_your_images = 'images/**/*.{jpg,JPG,jpeg,JPEG,png,svg,gif}';
const OUTPUT_path = 'public/static/images/';
compress_images(
INPUT_path_to_your_images,
OUTPUT_path,
{
compress_force: false,
statistic: true,
autoupdate: true
},
false,
{ jpg: { engine: 'mozjpeg', command: ['-quality', '70'] } },
{ png: { engine: 'pngquant', command: ['--quality=50-70', '-o'] } },
{ svg: { engine: 'svgo', command: '--multipass' } },
{ gif: { engine: 'gifsicle', command: ['--colors', '256', '--use-col=web'] } },
function(error, completed, statistic)
{
console.log('-------------');
console.log(error);
console.log(completed);
console.log(statistic);
console.log('-------------');
}
);