@ds-starter/fonts
v0.2.0
Published
> **@ds-starter/fonts** is the part of the [Design System Starter (DSS) Template](https://github.com/XOP/design-system-starter) > The package is created for demo purposes and is not intended for production usage > See it in action: > - [DSS Storyboo
Downloads
1
Readme
DSS Fonts @ Design System Starter Template
@ds-starter/fonts is the part of the Design System Starter (DSS) Template
The package is created for demo purposes and is not intended for production usage
See it in action:
Overview
Fonts package is optional and created for convenient fonts management.
In most cases it makes sense to setup custom loading, you will need to take care of fonts delivery.
However for quick hacking or dev-oriented projects base64-encoded files can work just fine.
Installation
npm i @ds-starter/fonts
Usage
Base64 fonts
import '@ds-starter/fonts/css/fonts.css';
Google Fonts helper
Note, this component is supposed to be used on server side.
import { GoogleFonts } from '@ds-starter/fonts';
// ...
<html>
<head>
<GoogleFonts weights={[400, 700]} />
</head>
</html>
Interface
interface FontsProps {
// font-weights
weights: number[] | string[];
// font-display method, 'swap' by default
display?: 'swap' | 'auto' | 'block' | 'fallback' | 'optional';
// use of preconnect, true by default
preconnect?: boolean;
}
Development
To build the package run the standard command:
pnpm build
Lint:
pnpm lint
Format:
pnpm format
Note that local commands don't consider workspace dependencies - make sure to build everything in advance.
Alternatively, use globalturbo
commands (i.e.turbo dev
).
Explore turbo docs for more information.
References
- Fonts by Google Fonts
- Build is powered by Vite
- Fonts Loading Strategies by Zach Leatherman