1.0.2 • Published 4 years ago

@nonsugarless/manage-webp v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

DEPRECATED

This package was moved to @nonsugarless/webp-converter and will be no maintained. You can use the new one in the same way.

Features

You can convert images to WebP Images and delete unnecessary WebP Images automatically.

Installation

npm install @nonsugarless/manage-webp

Usage

Convert all images

$ mwebp convert

Start to watch images directory

$ mwebp watch

WebP Images will be converted automatically when images are added, changed and deleted.

Delete converted WebP Images

$ mwebp clean

Delete converted WebP Images whose original one no longer exists in originalDir

$ mwebp clean --all

Delete all WebP Images from destDir

Default configuration

PropDefaultDescription
destDir"./htdocs/img/"Path to output images directory from project root
originalDir"./htdocs/img/"Path to input images directory from project root
targetExt".+(jpg|jpeg|png|gif)"Extension of convert files
excludeFileNames"apple-touch-icon.png"Array of filenames that you don't want to convert
excludeDirNames[]Array of relative path from originalDir that you don't want to convert
webpConverterOption"-q 85"WebP convert options
webpConverterGifOption"-q 85"Gif WebP convert options

Optional configuration

You can use an optional configuration .managewebprc file in JSON or YAML format or managewebp.config.js file exporting a JS object by setting it project root directory.

{
	"destDir": "./dest/img/",
	"originalDir": "./src/img/",
	"targetExt": ".+(jpg|png|gif)",
	"excludeFileNames": ["apple-touch-icon.png", "og-image.png"],
	"excludeDirNames": ["foo/bar"], // ignore all files below ./dest/img/foo/bar/
	"webpConverterOption": "-q 75 -sharp_yuv -m 5 -mt",
	"webpConverterGifOption": "-q 90 -m 5 -mt"
}

License

MIT