A node library for converting .png and .jpg to .webp using webp-converter.
npm i simple-webp-converter --save-dev
# package.json
{
"scripts": {
"webp": "simple-webp-converter"
},
}
npm run webp
Running this will create a .webp copy on the same path as any .png or .jpg file (node_modules is excluded by default).
To change config, include the "simple-webp-converter"
property in package.json
Changes pattern to look for imagens in repository. The value must be a glob pattern string
# package.json
{
"simple-webp-converter": {
"src": "src/**/*.{png,jpg}"
}
}
Running with this configuration will create a .webp copy on the same path as the .png and .jpgs files located under /src folder
const simpleWebpConverter = require( "simple-webp-converter" );
// to run using default glob pattern
simpleWebpConverter();
// to run using custom pattern
simpleWebpConverter({
src: "assets/**/*.{png,jpg}"
});