go-webp

1.3.1 • Public • Published

go-webp Logo

go-webp

go-webp is a tool that helps develop convert all images (.png,.jpg and .jpeg) to webp image format by just one simple command line

NPM Version NPM Install Size NPM Downloads

why use webp image format

  1. provides superior lossless and lossy compression for images on the web.
  2. create smaller, richer images that make the web faster
  3. WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller than comparable JPEG images at equivalent SSIM quality index.
  4. Lossless WebP supports transparency (also known as alpha channel) at a cost of just 22% additional bytes.

why use go-webp package

instead of go to online services and upload you images and convert it to webp then change images name in files where use its

go-webp with one simple line in package.json:

  1. convert all images (.png, .jpg, .jpeg) to webp format
  2. remove old format of images (.png, .jpg, .jpeg)
  3. change images names in files where you use its

Installation

Either through cloning with git or by using npm (the recommended way):

npm install -g go-webp # or using yarn: yarn global add go-webp

And go-webp will be installed globally to your system path.

You can also install go-webp as a development dependency:

npm install --save-dev go-webp # or using yarn: yarn add go-webp -D

With a local installation, go-webp will not be available in your system path or you can't use it directly from the command line. Instead, the local installation of go-webp can be run by calling it from within an npm script (such as npm start) like the example below or using npx go-webp.

{
	"name": "...",
	"version": "0.1.0",
	"dependencies": {
		"...":"..."
	},
	"scripts": {
		"...": "...",
		"webp": "go-webp remove=true change=true"
	}
}

then you use

npm run webp # or using yarn: yarn run webp

Usage

By default go-webp change images names in files where you use its but not remove old images format (.png, .jpg, .jpeg) and

go-webp

For CLI options

  1. use the remove=true argument to remove old images format (.png, .jpg, .jpeg)
go-webp remove=true
  1. use the change=false argument to not change images names in files where you use its
go-webp change=false
  1. you can also combine them remove=true change=true to remove old images format (.png, .jpg, .jpeg) and change images names in files where you use its
go-webp remove=true change=true
  1. use the excludeFolders="public,api" argument to exclude folders from convertion
go-webp excludeFolders="public,api"
  1. use the excludeFiles="logo.png,favicon.ico,thumbnail.jpeg" argument to exclude files from convertion
go-webp excludeFiles="logo.png,favicon.ico,thumbnail.jpeg"

Bonus For React Developers: use exclude files for logo192.png, logo512.png, and favicon.ico

{
	"name": "...",
	"version": "0.1.0",
	"dependencies": {
		"...":"..."
	},
	"scripts": {
		"...": "...",
		"webp": "go-webp remove=true change=true excludeFiles=\"logo192.png,logo512.png,favicon.ico\""
	}
}

Support

This package costs me time to make and maintain every time.

[I am very 😀 about every coffee!]

Buy Me A Coffee

Dependents (0)

Package Sidebar

Install

npm i go-webp

Weekly Downloads

22

Version

1.3.1

License

MIT

Unpacked Size

18.9 kB

Total Files

6

Last publish

Collaborators

  • kirwako
  • s7v7n