@namchee/astro-subfont
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Astro Fontsubs

Astro integration of subfont library. Generate optimized font subset for your Astro site.

Prerequisites

  1. Astro 4.x

Installation

You can install this package through astro add

# Using pnpm
pnpm astro add @namchee/astro-subfont

# Using npm
npx astro add @namchee/astro-subfont

# Using yarn
yarn astro add @namchee/astro-subfont

# Using bun
bunx astro add @namchee/astro-subfont

Additionaly, you can also install this package manually

# Using pnpm
pnpm install -D @namchee/astro-subfont

# Using npm
npm install -D @namchee/astro-subfont

# Using yarn
yarn add -D @namchee/astro-subfont

# Using bun
bun add -D @namchee/astro-subfont

After installation, you can integrate this integration in your Astro config

import { defineConfig } from 'astro/config';

import { subset } from '@namchee/astro-subfont';

export default defineConfig({
  integrations: [
    subset(),
  ]
})

Configuration

This integration can be configured by passing a configuration object with the following properties:

Name Type Default Description
whitelist string '' Additional characters to be included in font subsets. Use this option if you find some characters are missing after subset.
optimizeVariableFonts boolean true Allow optimization of variable font features, such as weights and axes. Experimental.
inline boolean false Inline the optimized fonts directly in the @font-face declaration.
dynamic boolean false Analyze webfonts usage dynamically by running headless browsers.
debug boolean false Enable verbose output to stdout.

Acknowledgements

All credits goes to Munter for the awesome subfont library.

Package Sidebar

Install

npm i @namchee/astro-subfont

Weekly Downloads

36

Version

0.1.0

License

MIT

Unpacked Size

15.5 kB

Total Files

9

Last publish

Collaborators

  • namcheee