Coder Social home page Coder Social logo

go-webp's Introduction

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

go-webp's People

Contributors

kirwako avatar

Stargazers

Abdelhakim Nassif avatar

Watchers

 avatar

Forkers

benlyazid

go-webp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.