Socket
Book a DemoInstallSign in
Socket

grunt-fontmin-ex

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-fontmin-ex

grunt plugin to minimize CJK font

0.2.1
latest
Source
npmnpm
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

grunt-fontmin-ex

NPM

THERE IS JAPANESE README

Subset Fonts Maker

grunt plugin to minimize CJK fonts

Modifided by tamaina

  • Deleted css output
    • You should write @font-face in your css by yourself
  • Added woff2 output
    • By using ttf2woff2
    • It requires node-gyp to build itself
  • Added Japanese readme

Supported Font Type

Import

ttf, ttc, otf, woff, woff2

Output

ttf, woff, woff2

How to use

  • npm install grunt-fontmin-ex --save-dev
    
  • Add configuration in Gruntfile.js

Configuration

grunt.initConfig({
  fontmin: {
    options: {
      dest:    'www-bin/fonts/',  // default './'
      basedir: 'fonts/'           // default './'
      types:   ['ttf','woff','woff2'] // default
    },
    '{Source-hans*.otf}': {
      /* getText: (html) => string_of_characters_to_include
       * if not specified, use html-to-text
       */
      getText: getBody,
      src:  'www-bin/**/*.html'
    },
    'cn-cursive.ttf': {
      getText: getHeadings,
      src:  'www-bin/**/*.html'
    }
  }
})

grunt.loadNpmTasks('grunt-fontmin')

options (task-wide)

  • dest:
    • destination directory, include trailing slash
    • default: ./
  • basedir:
    • source font directory, include trailing slash
    • default: ./
  • types:
    • *Array*.
    • output extention(s)
    • 'ttf', 'woff', 'woff2' are supported.

target options

  • grunt's target name
    • relative to basedir, pattern of fonts to minimize
    • pass to grunt.file.expand()
  • src:
    • pattern of files, relative to Gruntfile
    • src's content is passed to getText, it returns characters to included in minimized font
  • getText:
    • filter function: (htmlContent) => string_of_chars_to_include
    • if not provided, use builtin html-to-text
    • you can write your own
  • woff:
    • output compressed woff, anything other than undefined
    • default if no other output option is provided (like css)

Information

You can't change output filename

You are responsible to get proper license of fonts you minify!

or consider free fonts

or The 🇯🇵 Web Fonts

License

MIT (C) wacky6 MIT (C) tamaina

Keywords

grunt

FAQs

Package last updated on 17 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.