Skip to content

valpackett/broccoli-webp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A Broccoli plugin for converting JPEG/PNG images to WebP.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published