@aleph-alpha/config-fonts
v0.2.0
Published
Embedded WOFF2 web fonts (Raleway, Roboto, Montserrat, Inter) as base64 data URIs. Framework-agnostic — used by @aleph-alpha/config-unocss's webfonts preset but reusable from any framework.
Downloads
997
Readme
Config Fonts
@aleph-alpha/config-fonts
Embedded WOFF2 web fonts as base64 data URIs. Framework-agnostic — primary consumer is @aleph-alpha/config-unocss's webfonts preset, but the binaries are usable from any framework (MUI, plain CSS, Tailwind, …).
Installation
pnpm add @aleph-alpha/config-fontsUsage
import { raleway500, roboto500, montserrat600, inter400 } from '@aleph-alpha/config-fonts';
// Each export is a base64-encoded WOFF2 data URI (`data:…;base64,…`) you can drop into a @font-face src.
const css = `@font-face { font-family: 'Raleway'; src: url(${raleway500}) format('woff2'); font-weight: 500; }`;Available fonts
| Family | Weights | |---|---| | Inter | 400, 500, 600, 700 | | Montserrat | 500, 600, 700 | | Raleway | 500, 600, 700 | | Roboto | 500, 600, 700 |
Adding a font
Use the included converter to turn a .woff2 binary into a base64-encoded TS module:
node src/utils/convert-fonts.js path/to/myfont.woff2 src/fonts/myfont.woff2.tsThen re-export it from src/index.ts.
