Last active
September 1, 2020 13:58
-
-
Save rjriel/71d60d425e994515cd66bb6e08e4fa27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const imagemin = require('imagemin'), // The imagemin module. | |
webp = require('imagemin-webp'), // imagemin's WebP plugin. | |
outputFolder = './src/assets', // Output folder | |
PNGImages = './src/assets/*.png', // PNG images | |
JPEGImages = './src/assets/*.jpg' // JPEG images | |
imagemin([PNGImages], outputFolder, { | |
plugins: [ | |
webp({ | |
lossless: true // Losslessly encode images | |
}) | |
] | |
}) | |
imagemin([JPEGImages], outputFolder, { | |
plugins: [ | |
webp({ | |
quality: 65 // Quality setting from 0 to 100 | |
}) | |
] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment