https://github.com/wobsoriano/unplugin-font-to-buffer
Import font files as Buffer.
https://github.com/wobsoriano/unplugin-font-to-buffer
nuxt rollup satori unplugin vite
Last synced: 4 months ago
JSON representation
Import font files as Buffer.
- Host: GitHub
- URL: https://github.com/wobsoriano/unplugin-font-to-buffer
- Owner: wobsoriano
- License: mit
- Created: 2022-12-05T08:18:16.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-26T16:46:58.000Z (over 2 years ago)
- Last Synced: 2025-03-27T14:47:33.951Z (7 months ago)
- Topics: nuxt, rollup, satori, unplugin, vite
- Language: TypeScript
- Homepage:
- Size: 95.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unplugin-font-to-buffer
Import font files as Buffer. Meant to be used with [satori](https://github.com/vercel/satori).
## Install
```bash
pnpm add unplugin-font-to-buffer -D
```Vite
```ts
// vite.config.ts
import FontToBuffer from 'unplugin-font-to-buffer/vite'export default defineConfig({
plugins: [FontToBuffer()],
})
```
Rollup
```ts
// rollup.config.js
import FontToBuffer from 'unplugin-font-to-buffer/rollup'export default {
plugins: [FontToBuffer()],
}
```
Nuxt
```ts
// nuxt.config.js
export default defineNuxtConfig({
// Applied on Nitro only
modules: ['unplugin-font-to-buffer/nuxt'],
})
```
Webpack
```ts
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-font-to-buffer/webpack')()
]
}
```
esbuild
```ts
// esbuild.config.js
import { build } from 'esbuild'
import FontToBuffer from 'unplugin-font-to-buffer/esbuild'build({
plugins: [FontToBuffer()],
})
```
```jsx
import satori from 'satori'
import Roboto from './lib/fonts/Roboto-Regular.ttf'const svg = await satori(
hello, world,
{
width: 600,
height: 400,
fonts: [
{
name: 'Roboto',
data: Roboto,
weight: 400,
style: 'normal',
},
],
},
)
```## License
MIT