https://github.com/valpackett/broccoli-webp
A Broccoli plugin for converting JPEG/PNG images to WebP.
https://github.com/valpackett/broccoli-webp
broccoli broccoli-plugin webp
Last synced: 2 months ago
JSON representation
A Broccoli plugin for converting JPEG/PNG images to WebP.
- Host: GitHub
- URL: https://github.com/valpackett/broccoli-webp
- Owner: valpackett
- License: unlicense
- Created: 2014-04-01T18:36:49.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-04-04T13:02:30.000Z (about 9 years ago)
- Last Synced: 2025-03-14T23:05:06.013Z (3 months ago)
- Topics: broccoli, broccoli-plugin, webp
- Language: JavaScript
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# broccoli-webp [](https://www.npmjs.org/package/broccoli-webp) [](https://www.npmjs.org/package/broccoli-webp) [](https://travis-ci.org/myfreeweb/broccoli-webp) [](https://gemnasium.com/myfreeweb/broccoli-webp) [](http://unlicense.org)
This [Broccoli] plugin converts JPEG/PNG files to [WebP].
[Broccoli]: https://github.com/joliss/broccoli
[WebP]: https://developers.google.com/speed/webp/## Installation
Install just like any other broccoli plugin:
```bash
npm install --save-dev broccoli-webp
```[cwebp-bin](https://www.npmjs.org/package/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
```js
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
```js
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](http://contributor-covenant.org/version/1/4/).
## License
This is free and unencumbered software released into the public domain.
For more information, please refer to the `UNLICENSE` file or [unlicense.org](http://unlicense.org).