0.1.0 • Published 1 year ago

@namchee/astro-subfont v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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:

NameTypeDefaultDescription
whiteliststring''Additional characters to be included in font subsets. Use this option if you find some characters are missing after subset.
optimizeVariableFontsbooleantrueAllow optimization of variable font features, such as weights and axes. Experimental.
inlinebooleanfalseInline the optimized fonts directly in the @font-face declaration.
dynamicbooleanfalseAnalyze webfonts usage dynamically by running headless browsers.
debugbooleanfalseEnable verbose output to stdout.

Acknowledgements

All credits goes to Munter for the awesome subfont library.