# google-fonts-helper

> Google Fonts Helper

Latest version **3.7.4** (published 2026-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install google-fonts-helper
pnpm add google-fonts-helper
yarn add google-fonts-helper
bun add google-fonts-helper
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.7.4 |
| Published | 2026-03-26 |
| First published | 2020-07-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 1.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ricardogobbosouza |

## Links

- npm: https://www.npmjs.com/package/google-fonts-helper
- Repository: https://github.com/datalogix/google-fonts-helper
- Homepage: https://github.com/datalogix/google-fonts-helper#readme
- Issues: https://github.com/datalogix/google-fonts-helper/issues
- npm.io page: https://npm.io/package/google-fonts-helper

## Dependencies (4)

- [ufo](https://npm.io/package/ufo.md) ^1.5.4
- [ofetch](https://npm.io/package/ofetch.md) ^1.4.1
- [hookable](https://npm.io/package/hookable.md) ^5.5.3
- [deepmerge](https://npm.io/package/deepmerge.md) ^4.3.1

## Recent versions

- 3.7.4 (latest) — 2026-03-26
- 3.7.3 — 2025-03-13
- 3.7.2 — 2025-03-12
- 3.7.1 — 2025-03-12
- 3.7.0 — 2025-03-12
- 3.6.0 — 2024-05-02
- 3.5.0 — 2024-03-14
- 3.4.1 — 2023-12-06
- 3.4.0 — 2023-11-23
- 3.3.3 — 2023-11-23
- 3.3.2 — 2023-11-23
- 3.3.1 — 2023-07-21
- 3.3.0 — 2023-04-17
- 3.2.4 — 2023-03-03
- 3.2.3 — 2023-02-18
- … 17 more at https://npm.io/package/google-fonts-helper/versions

## README

# google-fonts-helper

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]

> [Google Fonts Helper](https://developers.google.com/fonts)

[📖 **Release Notes**](./CHANGELOG.md)

## Install

Install using npm, yarn or pnpm:

```bash
npm install google-fonts-helper
# or
yarn add google-fonts-helper
# or
pnpm add google-fonts-helper
```

Import into your Node.js project:

```js
const {
  constructURL,
  merge,
  isValidURL,
  parse,
  download,
} = require("google-fonts-helper");
// or
import {
  constructURL,
  merge,
  isValidURL,
  parse,
  download,
} from "google-fonts-helper";
```

## Usage

### `constructURL(): string`

```ts
constructURL({ families: { Roboto: true } });
// https://fonts.googleapis.com/css2?family=Roboto

constructURL({ families: { Roboto: true, Lato: true } });
// https://fonts.googleapis.com/css2?family=Roboto&family=Lato

constructURL({ families: { "Crimson Pro": { wght: "200..400" } } });
// https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@200..400

constructURL({
  families: {
    Roboto: true,
    Lato: {
      wght: 100,
    },
    Raleway: {
      wght: [400],
      ital: [100, 400],
    },
  },
});
// https://fonts.googleapis.com/css2?family=Roboto&family=Lato:wght@100&family=Raleway:ital,wght@0,400;1,100;1,400
```

### `merge(...fonts: GoogleFonts[]): GoogleFonts`

```ts
merge({ families: { Roboto: true } }, { families: { Lato: true } });
// { families: { Roboto: true, Lato: true } }

merge({ families: { Roboto: true } }, { families: { Roboto: [300, 400] } });
// { families: { Roboto: [300, 400] } }
```

### `isValidURL(url: string): boolean`

```ts
isValidURL("https://fonts.googleapis.com/css2?family=Roboto");
// true

isValidURL("https://foo.bar");
// false
```

### `parse(url: string): GoogleFonts`

```ts
parse("https://fonts.googleapis.com/css2?family=Roboto");
// { families: { Roboto: true } }

parse("https://fonts.googleapis.com/css2?family=Roboto&family=Lato");
// { families: { Roboto: true, Lato: true } }

parse("https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@200..400");
// { families: { 'Crimson Pro': { wght: '200..400' } }

parse("https://foo.bar");
// {}
```

### `download(url: string, option?: DownloadOptions): Downloader`

```ts
const downloader = download('https://fonts.googleapis.com/css2?family=Roboto', {
  base64: false,
  overwriting: false,
  outputDir: './',
  stylePath: 'fonts.css',
  fontsDir: 'fonts',
  fontsPath: './fonts'
})

downloader.hook('download-font:before', (font: FontInputOutput) {
  console.log(font)
})

downloader.hook('download-font:done', (font: FontInputOutput) {
  console.log(font)
})

downloader.hook('download:start', () => {
  console.log('Downloading fonts...')
})

downloader.hook('download:complete', () => {
  console.log('Download fonts completed.')
})

await downloader.execute()
```

## License

[MIT License](./LICENSE)

Copyright (c) Datalogix

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/google-fonts-helper/latest.svg
[npm-version-href]: https://npmjs.com/package/google-fonts-helper
[npm-downloads-src]: https://img.shields.io/npm/dt/google-fonts-helper.svg
[npm-downloads-href]: https://npmjs.com/package/google-fonts-helper
[github-actions-ci-src]: https://github.com/datalogix/google-fonts-helper/workflows/ci/badge.svg
[github-actions-ci-href]: https://github.com/datalogix/google-fonts-helper/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/github/datalogix/google-fonts-helper.svg
[codecov-href]: https://codecov.io/gh/datalogix/google-fonts-helper
[license-src]: https://img.shields.io/npm/l/google-fonts-helper.svg
[license-href]: https://npmjs.com/package/google-fonts-helper

---
_Source: https://npm.io/package/google-fonts-helper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
