Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork11
Framework agnostic tools for accessing data from font CDNs and providers
License
unjs/unifont
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Framework agnostic tools for accessing data from font CDNs and providers
Install package:
# npmnpm install unifont
import{createUnifont,providers}from'unifont'constunifont=awaitcreateUnifont([providers.google(),])constfonts=awaitunifont.resolveFont('Poppins')console.log(fonts)constavailableFonts=awaitunifont.listFonts()console.log(availableFonts)
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.
- Clone this repository
- EnableCorepack using
corepack enable
- Install dependencies using
pnpm install
- Run interactive tests using
pnpm dev
Made with ❤️
Published underMIT License.
About
Framework agnostic tools for accessing data from font CDNs and providers
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.