Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Broccoli plugin for converting JPEG/PNG images to WebP.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
COPYING
README.md
index.js
package.json

README.md

broccoli-webp npm version npm downloads Dependency Status WTFPL

This Broccoli plugin converts JPEG/PNG files to WebP.

Installation

First, get cwebp...

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

... OR add webp-bin or webp to your deps too.

Second, install as any other broccoli plugin:

npm install --save-dev broccoli-webp

Usage

var convertToWebP = require('broccoli-webp');

var outputTree = convertToWebP(inputTree, options);
  • inputTree: A 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 convertToWebP = require('broccoli-webp');

var img = "img";

var webp = convertToWebP(img, {quality: 80});

return [img, webp];

License

Copyright © 2014 myfreeweb This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details.

Something went wrong with that request. Please try again.