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

vite-plugin-material-symbols

v0.9.0

Published

Selective loading of Material Symbols for production

Readme

vite-plugin-material-symbols

License coverage Downloads

Material Symbols is a font-based alternative to SVG icons. Compared to Material Icons, which are packed into a bundle, thereby increasing its size, font-based symbols are loaded on the user side upon request.

However, the difficulty is that they are either loaded all at once, which is also quite a large volume, or it is necessary to specify a list of icon_names for filtering the font, which must also be sorted. Therefore, it is necessary to maintain the list of icons used within the application.

The plugin automates that job by determining which icons are used in the source code of the application and during the build substitutes that list into index.html for selective download from Google Font CDN, thus reducing the volume of the font downloaded by the user.

Requirements

  • Node.js ^22 || ^24 || ^26;
    • use the plugin version 0.6 for Node 20;
  • Vite ^8
    • use the plugin version 0.6 for Vite 6 and 7;

Installation

Install the plugin using your favourite package manager, for example:

pnpm add -D vite-plugin-material-symbols

Add it to the Vite configuration:

// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import materialSymbols from "vite-plugin-material-symbols";

export default defineConfig({
  plugins: [react(), materialSymbols()],
});

Ensure having <head> tag in your index.html.

Ensure assigning the required className to your icons. When using Material UI it can be globally configured:

const theme = createTheme({
  components: {
    MuiIcon: {
      defaultProps: {
        /* @see https://fonts.google.com/icons?icon.set=Material+Symbols */
        className: "material-symbols-outlined", // or -rounded or -sharp
      },
    },
  },
});

Usage

Consider a sample React component using MUI Icon:

import Stack from "@mui/material/Stack";
import Icon from "@mui/material/Icon";

const Component = () => (
  <Stack gap={2}>
    <Icon>home</Icon>
    <Icon>chevron_right</Icon>
    <Icon>comment</Icon>
  </Stack>
);

After running vite build, the <link> tag will be added to your index.html having the list of required icon names:

<link
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=chevron_right,comment,home"
  rel="stylesheet"
/>

Limitations

The plugin substitutes the icon_names URL parameter ONLY in vite build mode. In vite dev (serve) mode index.html is transformed before the application source code, so that all Material Symbols are loaded.

Configuration

The plugin accepts an object of the following options:

moduleIdRegex:
  type: RegExp
  description: The regex to match module IDs that should be processed for finding icon names
  default: /\.([jt])sx?$/i # *.js, *.jsx, *.ts, *.tsx
jsxNodeRegex:
  type: RegExp
  description: The regex to match JSX nodes that should be processed in parsed AST (e.g. "jsx", "_jsx" or "jsxs")
  default: /jsx/
component:
  type: string | RegExp
  description: The name of JSX component to get the icon names from (or regex to match the component name)
  default: Icon
fontUrl:
  type: string
  description: Material Symbols CSS Provider
  # Standard settings: Outlined, no infill, 24px, weight 400
  default: https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0
paramName:
  type: string
  description: The name of the query parameter to add to the fontUrl
  default: icon_names
preload:
  type: boolean
  description: Enables higher priority for loading symbols
  default: false