npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-webpify

v0.1.0

Published

Convert all image assets in a React project to WebP and rewrite every code/CSS/HTML/JSON reference automatically.

Readme

react-webpify

A zero-config CLI that converts every image asset in your React project to WebP and rewrites all references — import statements, JSX src, CSS url(...), HTML, and JSON manifests.

Run once at the root of any React app (CRA, Vite, Next, etc.) and ship smaller images instantly.

npx react-webpify

What it does

  1. Scans your project (src/, public/, assets/, static/ by default) for .png, .jpg, .jpeg, and static .gif files.
  2. Converts each to .webp using sharp.
  3. Rewrites every reference in your code — across .js / .jsx / .ts / .tsx / .css / .scss / .less / .html / .json — to point at the new .webp.
  4. Deletes the originals (override with --keep-original).
  5. Prints a summary with bytes saved.

It works on every common ref shape: relative imports, root-absolute paths (/logo.png), CSS url(...), HTML attributes, and JSON manifest entries. References are only modified inside string/URL contexts, so identifiers, comments, and unrelated substrings are never touched.

Install / Run

# one-shot, no install
npx react-webpify

# or add as a project script
npm i -D react-webpify

package.json:

{
  "scripts": {
    "webpify": "react-webpify"
  }
}

Options

npx react-webpify [options]

  --dry-run              show what would change, write nothing
  --keep-original        don't delete source images after conversion
  --quality <n>          webp quality, 1-100 (default: 80)
  --include <globs...>   extra dirs/globs to scan (default: src, public, assets, static)
  --ignore <globs...>    additional paths to skip
  --force                overwrite existing .webp files of the same basename
  --no-update-refs       convert images only, leave code untouched
  --verbose              print per-file logs
  --cwd <path>           project root (default: current working directory)

Try a dry run first:

npx react-webpify --dry-run --verbose

Caveats

  • Dynamic refs: paths built at runtime (e.g. `${base}/${name}.png` or name + '.png') cannot be rewritten safely. The tool detects these and prints them as warnings so you can fix manually.
  • Animated GIFs: skipped by default — animated WebP is supported by sharp but lossy/risky enough that we leave them alone.
  • Path aliases: bundler aliases like @/ are resolved heuristically (we try common forms). If you use a custom alias, double-check the resulting diff or run --dry-run first.
  • Idempotent: running twice is a no-op. Safe to wire into CI.

License

MIT