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

@gpits/vite-fontsource-variable-discover

v1.0.0

Published

A vite plugin that discovers fontsource-variable fonts from package.json and can export them to 1) a css file containing import statements, and 2) a json file containing their main metadata

Readme

@gpits/vite-fontsource-variable-discover

About

Vite plugin for discovering installed @fontsource-variable fonts.

This plugin discovers the @fontsource-variable font packages installed by your application and can generate the corresponding font resources during the Vite build/dev workflow.

There following are also available, for more specialised needs:

  • The underlying library which can also be used independently as a TypeScript/JavaScript library or CLI when Vite integration is not required.
  • A Statamic Custom Dictionary that makes the fonts list available as a field in the Statamic control panel.

This package was developed to support a project of GUNET.

Why?

@fontsource-variable provides a large collection of variable fonts, but some applications still need a way to determine which fonts are installed.

Rather than maintaining a separate list of fonts, this plugin derives that information directly from the application's installed dependencies.

This is particularly useful for Vite applications that need to:

  • dynamically discover available fonts;
  • generate a font stylesheet;
  • expose font metadata to other application code;
  • keep font configuration synchronized with package.json.

How it works

  1. Reads the application's package.json.
  2. Finds dependencies whose names start with @fontsource-variable/ and resolves the installed font packages.
  3. Reads each package's metadata.json.
  4. Optionally generates a CSS file with the @import statements required for using the fonts.
  5. Optionally generates a JSON file with the main metadata of discovered fonts.

Installation

Install the plugin and the discovery library:

npm install @gpits/vite-fontsource-variable-discover

Also install the variable fonts you want to use, e.g.:

npm install @fontsource-variable/inter
npm install @fontsource-variable/roboto-mono

Usage

Add the plugin to your Vite configuration:

import fontsourceVariableDiscover from "@gpits/vite-fontsource-variable-discover";
    plugins: [
        fontsourceVariableDiscover({
            cssPath: "resources/css/fonts.css",
            jsonPath: "resources/json/fonts.json",
        }),
        ...
    ],

Configuration

The plugin accepts the following options:

  • includeDevDependencies (boolean): By default, development dependencies are not included. This includes them.
  • cssPath: The path where to write the CSS file. If not specified, no CSS file will be emitted.
  • jsonPath: The path where to write the JSON file. If not specified, no JSON file will be emitted.

Example

A complete configuration might look like:

import { defineConfig } from "vite";
import fontsourceVariableDiscover from "@gpits/vite-fontsource-variable-discover";
export default defineConfig({
    plugins: [
        fontsourceVariableDiscover({
            cssPath: "resources/css/fonts.css",
            jsonPath: "resources/json/fonts.json",
            includeDevDependencies: true,
        }),
    ],
});

If your application has:

"dependencies": {
    "@fontsource-variable/inter": "5.2.6",
},
"devDependencies": {
    "@fontsource-variable/roboto-mono": "5.2.6"
}

then the plugin will produce a CSS file containing the necessary @import statements:

@import "@fontsource-variable/inter";
@import "@fontsource-variable/roboto-mono";

and a JSON file containing the discovered font metadata:

[
  {
    "key": "inter",
    "name": "Inter",
    "family": "Inter Variable",
    "package": "@fontsource-variable/inter",
    "category": "sans-serif"
  },
  {
    "key": "roboto-mono",
    "name": "Roboto Mono",
    "family": "Roboto Mono Variable",
    "package": "@fontsource-variable/roboto-mono",
    "category": "monospace"
  }
]

Issue tracker

At https://todo.sr.ht/~giorgio93p/fontsource-variable-discover.

Please specify that your issue is related to @gpits/vite-fontsource-variable-discover.

License

European Union Public Licence 1.2