Giter Club home page Giter Club logo

chinese-fontmin-webpack-plugin's Introduction

chinese-fontmin-webpack-plugin

中文 Fontmin Webpack 插件

目前该插件支持以下功能:

  • 常用汉字提取,包括:
    • 《现代汉语常用字表》常用字(2500字)
    • 《现代汉语常用字表》次常用字(1000字)
    • 《现代汉语通用字表》(7000字)
  • 常见符号数字提取,如:
    • 26 个英文字母和部分法文字母
    • 数字
    • 常用中英文符号
  • 自定义文字提取

如何使用

目前,此插件是基于 Webpack 5 开发的,Webpack 4.x 版本未经测试。

在配置前,先执行安装:

# npm
npm i -D chinese-fontmin-webpack-plugin

# yarn
yarn add -D chinese-fontmin-webpack-plugin

webpack.config.js 下的 plugins 字段里,添加以下代码:

const {ChineseFontminWebpackPlugin} = require('chinese-fontmin-webpack-plugin')
...

plugins: [
  new ChineseFontminWebpackPlugin({
      han2500: true, // 是否提取常用 2500 汉字
      han1000: true, // 是否提取常用 1000 汉字
      han7000: false, // 是否提取常用 7000 汉字
      alphabet: true, // 是否提取字母
      number: true, // 是否提取数字
      punctuation: true, // 是否提取标点符号
      custom: {
        text: '', // 自定义文字
        replace: false, // 是否覆盖上述的字段(如常用汉字),是则只提取自定义文字,否则在上述字段后追加自定义文字
      },
  }),
],

...

例子

请查看 example 文件夹内的 webpack.config.js 文件。

注意事项

在使用前,请先下载 Fontmin app,确保字体文件在 app 中本身就能正确提取。

custom.text = ''custom.replace = true 的时候,Fontmin 会直接输入原来的文件。

chinese-fontmin-webpack-plugin's People

Contributors

meetyan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.