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

font-packer-webpack-loader

v0.1.0

Published

font-packer-webpack-loader

Downloads

8

Readme

font-packer-webpack-loader

模板来自 quick-scaffold template-package-node

description

字体打包的 webpack loader

会提取配置中涉及的所有文本, 提取到 .ttf 文件; 生成的 .ttf 文件仅会包含配置中所涉及的文本

目前仅支持源文件为 .ttf 的提取

(不支持源文件为 .woff 或其他格式的提取, 对于不支持的文件会自动跳过)

如果你只有 .woff 文件, 那就手动转成 .ttf 再来吧

不知道怎么转的, 可以试试这个 https://convertio.co/zh/woff-ttf/ (随便百度的一个)

Install

yarn add -D font-packer-webpack-loader

Usage

// webpack.config.js

const SRC = path.resolve("src")

module.exports = {
  // ...
  module: {
    rules: [
      // ...
      {
        test: /\.ttf(\?.*)?$/i,
        include: SRC,
        use: [
          // 正常 .ttf 文件需要的 loader
          {
            loader: "url-loader",
            options: {
              limit: 8192,
              name: "assets/fonts/[name].[contenthash:5].[ext]",
            },
          },
          // 在下面新增本 loader
          {
            loader: "font-packer-webpack-loader",
            options: {
              texts: [
                "这是可选的、需要额外提取的文本",
              ],
              filesOrDirs: [
                // 可选
                // 示例是 src 目录, 你可以配置任何文件或目录, 会将该 文件/目录 中的文本提取到 .ttf 文件中
                SRC,
              ],
            },
          },
        ],
      },
    ],
  },
}

项目特点

  • typescript