koa-accept-webp
Koa middleware for serving webp images when support is detected
Install
npm install koa-accept-webp
Usage
const Koa = const static = const acceptWebp = const app = // Add the acceptWebp middleware before the statics middleware,// so it can redirect image requests to the webp versionsappappapp
Arguments
acceptWebp(root[, extensions])
Argument | Type | Description | Default | Required |
---|---|---|---|---|
root | String | Statics root directory | Yes | |
extensions | Array | Extensions that can be served as webp | ['jpg', 'jpeg', 'png'] |
No |
License
MIT