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 🙏

© 2024 – Pkg Stats / Ryan Hefner

rollup-plugin-md-icon

v1.0.0

Published

Minify md icons and font in your app.

Downloads

69

Readme

rollup-plugin-md-icon

Published on npm

Generates fonts with only the symbols you use in your app ✨

Install

npm add -D rollup-plugin-md-icon

Usage

👷 During development

Do not use anything ! Just add this stylesheet in the header of your html document:

<head>
  <link
    id="symbols"
    href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined"
    rel="stylesheet"
  />
</head>

This stylesheet serves a font that contains all symbols from fonts.googleapis.com (learn more)

📦 At build time

We'll need to convert the link above.
From here you can opt one of 2 strategies:

1️⃣ Serve minified font file from fonts.googleapis.com : See instructions on the wiki.

It's the easiest option. The plugin will update the href in the final html to request a stylesheet that will load a font file that contains only the icons your app needs (That will count for 2 http requests).

2️⃣ Serve font file locally : See instructions on the wiki.

Less intuitive to implement but recommended. The plugin will download the stylesheet and the minified font so you have more control on how you serve them (e.g. bundling the stylesheet directly in a module, caching the font in a service worker, etc..)

Development

The monorepo of this plugin can be found here

How it works

The plugin scans the source code to build a list of all used icons called a codepoints list which is saved under the cache directory .mdicon. The cache system is used to avoid downloading the fonts every time rollup runs (which can happen a lot during development). The cached codepoints list is used to generate minimal final font files or urls depending on which strategy you use at build time.

Known limitations

  • The plugin scans all the files matching the provided glob pattern (option include) which means the final font could potentially includes icons that are or will not be used at runtime if some files are being excluded from the module graph at build time.

License

MIT