A Google Fonts library specifically designed for the v2 API and variable fonts, which helps to load them in the browser.
npm install google-fonts-loader-v2



A Google Fonts library specifically designed for the v2 API and variable fonts, which helps to load them in the browser.
shell
npm install google-fonts-loader-v2
or
yarn add google-fonts-loader-v2
or
pnpm add google-fonts-loader-v2
or
bun add google-fonts-loader-v2
`📖 Usage
`javascript
import {loadAwait, list, unload} from "google-fonts-loader-v2";console.log("Loading Open Sans…");
await loadAwait({
family: "Open Sans",
axisTupleList: [
[
{tag: "ital", value: 0},
{tag: "wght", value: 500},
],
[
{tag: "ital", value: 1},
{tag: "wght", value: 500},
],
],
}, {
display: "swap",
});
console.log("Open Sans loaded!");
console.log(
${list().length} fonts loaded!);console.log("Unloading Open Sans…");
unload({
family: "Open Sans",
});
console.log("Open Sans unloaded!");
`📚 Documentation
$3
`typescript
load(font: Font, options?: Options): void
`
Just load the given font in the curent page.$3
`typescript
loadAwait(font: Font, options?: Options): Promise
`
Load the given font and return a promise that resolve when the font is fully loaded.$3
`typescript
list(): Font[]
`
List the currently loaded fonts.$3
`typescript
unload(font: Font): void
`
Unload the given font family.$3
`typescript
unloadAll(): void
``- https://fonts.googleapis.com/css2?family=Nabla:EHLT@5;12&display=swap seems to return 400 code while this query should be valid