This Broccoli plugin converts JPEG/PNG files to WebP.
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
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 qualitycompression
(number, 0 -- fast, 6 -- slowest): compression strength
var Webp = require('broccoli-webp')
var img = 'img'
var webp = new Webp(img, {quality: 80})
return [img, webp]
Please feel free to submit pull requests!
By participating in this project you agree to follow the Contributor Code of Conduct.
This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE
file or unlicense.org.