A Broccoli plugin for converting JPEG/PNG images to WebP.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
README.md
UNLICENSE
index.js
package.json

README.md

broccoli-webp npm version npm downloads Build Status Dependency Status Unlicense

This Broccoli plugin converts JPEG/PNG files to WebP.

Installation

Install just like any other broccoli plugin:

npm install --save-dev broccoli-webp

cwebp-bin is listed as an optional dependency.
If you can't install it, install cwebp manually:

  • FreeBSD: pkg install graphics/webp
  • OS X: brew install webp
  • Ubuntu/Debian: sudo apt-get install webp

Usage

var Webp = require('broccoli-webp')

var outputNode = new Webp(inputNode, options)
  • inputNode: A node (tree) that contains the images you want to convert.
  • options: A hash of options. Currently supported:
    • quality (number, 0..100): compression quality for JPEGs (PNGs are converted to lossless WebP)
    • alphaQuality (number, 0..100): transparency quality
    • compression (number, 0 -- fast, 6 -- slowest): compression strength

Example

var Webp = require('broccoli-webp')

var img = 'img'

var webp = new Webp(img, {quality: 80})

return [img, webp]

Contributing

Please feel free to submit pull requests!

By participating in this project you agree to follow the Contributor Code of Conduct.

License

This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE file or unlicense.org.