@io-arc/task-webp-converter

PNG, JPG, GIF files to Webp files conversions.
Using @io-arc/webp-converter

Usage#

$ npm i -D @io-arc/task-webp-converter
# once run# once run
$ NODE_ENV=development MODE_ENV=once ia-webp
# watch run
$ NODE_ENV=development MODE_ENV=watch ia-webp

Or

package.json
{
"scripts": {
"webp": "ia-webp"
}
}
$ npm run webp

Configuration#

The configuration is written in config/(default|local).yml.
Multiple targets can be specified.

local.yml
options:
webp:
- target: [src, img]
ext:
png: true
jpg: true
gif: false
options:
quality: 70
gifOptions:
lossy: true
deleteBefore: true
- target: [src, static]
ext:
png: true
jpg: true
gif: true
output: [dist, common, img]
deleteBefore: false

Only target are required.

target#

Required.
Target directories name array for image files used converter.

ext#

Target extensions.

Default
{
png: true,
jpg: true,
gif: false
}

options#

Convert options for PNG and JPG.
Default: See the imagemin-webp options.

gifOptions#

Convert options for GIF.
Default: See the imagemin-gif2webp options.

output#

Output directories name array.
Default same as target.

deleteBefore#

Delete the webp file before starting the task.
Default: true