Installation
npm install webp-jxr-middleware
Usage
webp-jxr-middleware should be used before any middleware that is serving files (e.g. express.static
) so that it serves changed format file.
;;; const app = ;const serverPath = ; app;app;
ES5
An ES5 compatibility build is also included at lib/es5.js
. To generate it from the source, run npm run build
.
You can then require it like:
var rewriteImg = default;
Overview
Middleware to serve JXR and WEBP images when the browser supports them. Works with Connect and Express.
It is based off connect-image-optimus and accept-webp. It maintains support for webp and jxr from the connect-image-optimus
and avoids the UA parsing like accept-webp
.
Development Setup
- Fork the repo
- Run
npm install
- Run
./node_modules/.bin/precommit install
- Run
npm run dev
to initiate the development server
Contributing
- Commit your changes following conventional-changelog format
- Push to a new branch (e.g.
git push origin my-awesome-feature
) - Create a new Pull Request
License
MIT