Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Framework agnostic tools for accessing data from font CDNs and providers

License

NotificationsYou must be signed in to change notification settings

unjs/unifont

Repository files navigation

npm versionnpm downloadsGithub ActionsCodecov

Framework agnostic tools for accessing data from font CDNs and providers

Usage

Install package:

# npmnpm install unifont
import{createUnifont,providers}from'unifont'constunifont=awaitcreateUnifont([providers.google(),])constfonts=awaitunifont.resolveFont('Poppins')console.log(fonts)

In most environments, you will want to cache the results of font APIs to avoid unnecessary hits to them. By defaultunifont caches font data in memory.

For full control,unifont exposes a storage API which is compatible withunstorage. It simply needs to expose agetItem andsetItem method.

import{createUnifont,providers}from'unifont'import{createStorage}from'unstorage'importfsDriverfrom'unstorage/drivers/fs-lite'conststorage=createStorage({driver:fsDriver({base:'node_modules/.cache/unifont'}),})constcachedUnifont=awaitcreateUnifont([providers.google()],{ storage})console.log(awaitcachedUnifont.resolveFont('Poppins'))// cached data is stored in `node_modules/.cache/unifont`

For more about the storage drivers exposed fromunstorage, check outhttps://unstorage.unjs.io.

💻 Development

  • Clone this repository
  • EnableCorepack usingcorepack enable
  • Install dependencies usingpnpm install
  • Run interactive tests usingpnpm dev

License

Made with ❤️

Published underMIT License.

About

Framework agnostic tools for accessing data from font CDNs and providers

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp