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

vite-plugin-fontiny

v0.2.3-beta.2

Published

A font file compression tool for Vite.

Downloads

37

Readme

vite-plugin-fontiny

npm version npm downloads bundle

Fontiny = Font + Tiny

A tool for removing unused Chinese characters from font files.

Currently only available for ttf format fonts, more will be supported in the future.

Roadmap

  • [x] Generate an html page showing which Chinese characters have been retained and which have been eliminated.
  • [ ] User-defined match characters rules.
  • [ ] Supports more types of font files, like otf, woff, woff2, eot.

Installation

npm i -D vite-plugin-fontiny

Usage

// vite.config.ts
import Fontiny from 'vite-plugin-fontiny'

export default {
  plugins: [
    Fontiny({
      // options
      fontFileNames: ['Example-Font-Regular.ttf']
    }),
  ],
}

It will search for Chinese characters in your code, and remove the unused characters from the font file to reduce the size of the font file.

ZCOOLKuaiLe-Regular.ttf [3,188 KB]

↓ ↓ ↓ ↓ ↓ ↓

Search for Chinese characters in code:

[ "只", "有", "在", "代", "码", "中", "出", "现", "过", "的", "中", "文", "字", "符", "会", "在", "字", "体", "文", "件", "中", "保", "留", "在", "输", "入", "框", "中", "输", "入", "新", "文", "字", "查", "看", "效", "果" ]

↓ ↓ ↓ ↓ ↓ ↓

Remove unused characters from the font file.

↓ ↓ ↓ ↓ ↓ ↓

ZCOOLKuaiLe-Regular-Cx0eLuEs.ttf [24 KB]

The actual compression effect is affected by the number of Chinese characters used in the code.

Options

fontFileNames

Which fonts you want to be compressed.

type FontFileNames = string[]

required: true

include

Included range of scanned codes.

type Include = ReadonlyArray<string | RegExp> | string | RegExp | null | undefined

required: false default: undefined

exclude

Excluded range of scanned codes.

type Exclude = ReadonlyArray<string | RegExp> | string | RegExp | null | undefined

required: false default: undefined

visualizer

If true, a visual HTML will be generated in the project root directory.

type Visualizer = boolean

required: false default: false

visualizer example image

Credits

Thanks to fonteditor-core, fontmin and @antfu