vite-plugin-webfont-dl weekly downloads statistics
By feat-agency · npm · Vite plugins
Vite plugin for downloading and injecting webfonts
vite-plugin-webfont-dl has 49,508 recorded weekly downloads on npm, an increase of 16.7% over the past 30 days, ranking #788 of 3,247 tracked listings.
About vite-plugin-webfont-dl
vite-plugin-webfont-dl
Webfont Download — a Vite plugin that downloads webfonts at build time and self-hosts them, eliminating render-blocking requests to third-party font providers.
The plugin collects webfont links, imports, and definitions from your project, downloads the CSS and font files, adds the fonts to your bundle (or serves them through the dev server), and injects the font definitions using a non-render-blocking method.
Features
- ⚡ Zero config — automatically detects webfont
<link>tags, plugin config URLs, and CSS@importstatements - 📦 Self-hosted fonts — font files are bundled with your app; no third-party requests at runtime
- 🚀 Non-render-blocking — fonts are injected as an inline
<style>tag or an asynchronously loaded stylesheet - 🔒 Privacy-first — visitors never connect to font CDNs, so no user data is exposed to third parties
- 💾 Persistent cache — downloaded CSS and font files are cached locally, enabling offline development
- 🧩 Broad compatibility — works with Vite 2–8, including the Rolldown-based Vite 8 (see framework notes)
Installation
# npm
npm i -D vite-plugin-webfont-dl
# pnpm
pnpm add -D vite-plugin-webfont-dl
# yarn
yarn add -D vite-plugin-webfont-dl
# bun
bun add -d vite-plugin-webfont-dl
Usage
There are two alternative ways to use the plugin — choose whichever fits your project, you don't need both:
- Zero config — keep your webfont provider's original
<link>snippet in your HTML; the plugin detects and replaces it automatically. - Simple config — no
<link>tags in your HTML; pass the webfont CSS URL(s) directly to the plugin instead.
Both methods lead to the same result: self-hosted, non-render-blocking webfonts — see That's all! below.
Zero config
Extracts, downloads, and injects fonts from the original code snippet of your webfont provider.
-
Select your font families at your webfont provider (e.g., Google Fonts) and copy the code from the "Use on the web" block into your
<head>:<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400&family=Roboto:wght@100&display=swap" rel="stylesheet"> -
Add
webfontDownloadto your Vite plugins without any configuration:// vite.config.js import webfontDownload from 'vite-plugin-webfont-dl'; export default { plugins: [ webfontDownload(), ], }; -
The original webfont tags are replaced with self-hosted font definitions in
dist/index.html:<style>@font-face{font-family:...;src:url(/assets/foo-xxxxxxxx.woff2) format('woff2'),url(/assets/bar-yyyyyyyy.woff) format('woff')}...</style>
Simple config
Extracts, downloads, and injects fonts from the configured webfont CSS URL(s).
-
Select your font families at your webfont provider and copy the CSS URL(s) from the "Use on the web" code block:
<link href="[CSS URL]" rel="stylesheet"> -
Pass the CSS URL(s) to the plugin:
// vite.config.js import webfontDownload from 'vite-plugin-webfont-dl'; export default { plugins: [ webfontDownload([ 'https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap', 'https://fonts.googleapis.com/css2?family=Fira+Code&display=swap', ]), ], };
That's all!
Whichever method you chose, the result is the same: the webfonts are downloaded, self-hosted, and injected — ready to use on both the local development server and in production builds:
h1 {
font-family: 'Press Start 2P', cursive;
}
h2 {
font-family: 'Fira Code', monospace;
}
Import alias: the plugin can be imported under any of these names:
webfontDownload,webfontDl,viteWebfontDl,ViteWebfontDownload, orviteWebfontDownload.
<img src="./img/terminal.png" alt="Terminal output showing downloaded webfonts" width="400" />Examples: the
examplesdirectory has minimal, runnable projects for vanilla, Vue, React, Svelte, and React Router.
Supported webfont providers
| Provider | Zero config<br>(HTML <link>) | Simple config<br>(CSS URL) | CSS @import<br>detection |
|---|---|---|---|
| Google Fonts | ✅ | ✅ | ✅ |
| Bunny Fonts | ✅ | ✅ | ✅ |
| Fontshare | ✅ | ✅ | ✅ |
Fira Code & Hack (cdn.jsdelivr.net) | ✅ | ✅ | — |
Inter (rsms.me) | ✅ | ✅ | — |
Any CSS with @font-face definitions | — | ✅ | — |
CSS
@importdetection: in addition to HTML tags and plugin config, the plugin also scans your bundled CSS for@importstatements pointing at the providers marked above and self-hosts those fonts as well (example). The same goes for@font-facerules in your CSS whose font files are hosted onfonts.gstatic.comorfonts.bunny.net.
Framework notes…
Description from the npm listing.
- vite
- vite-plugin
- web-font
- webfont
- webfont-dl
- webfont-download
- google-fonts
- bunny-fonts
- fontshare
- vue
- react
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm Vite plugins plugins
All 20 vite-plugin-webfont-dl alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/vite-plugin-webfont-dl. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.