# css-font-parser

> A parser for the CSS font value

Latest version **2.0.1** (published 2024-10-01) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install css-font-parser
pnpm add css-font-parser
yarn add css-font-parser
bun add css-font-parser
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2024-10-01 |
| First published | 2013-07-17 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 67.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Bram Stein |
| Maintainers | bramstein |
| Keywords | css, font, family, parser |

## Links

- npm: https://www.npmjs.com/package/css-font-parser
- Repository: https://github.com/bramstein/css-font-parser
- Homepage: https://github.com/bramstein/css-font-parser#readme
- Issues: https://github.com/bramstein/css-font-parser/issues
- npm.io page: https://npm.io/package/css-font-parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2024-10-01
- 2.0.0 — 2022-08-19
- 1.0.1 — 2022-08-17
- 0.3.0 — 2020-02-17
- 0.2.3 — 2017-09-14
- 0.2.2 — 2017-09-07
- 0.2.1 — 2015-11-17
- 0.2.0 — 2013-07-17

## README

## CSS font value parser

A simple parser for parsing CSS font values in JavaScript. It has a parser for the font shorthand syntax and the font-family syntax.

## Installation

You can install the parser using:

```bash
npm install css-font-parser
```

## Usage

```javascript
import { parseFont, parseFontFamily } from 'css-font-parser';

parseFont('15px sans-serif');

> {
>   'font-family': ['sans-serif'],
>   'font-size': '15px'
> }

parseFont('15px/18px "Neue Helvetica", Helvetica, sans-serif');

> {
>   'font-family': ['Neue Helvetica', 'Helvetica', 'sans-serif'],
>   'font-size': '15px',
>   'line-height': '18px'
> }

parseFontFamily('"Neue Helvetica", Helvetica, system-ui, sans-serif');

> ['Neue Helvetica', 'Helvetica', 'system-ui', 'sans-serif']
```

## License

Licensed under the three-clause BSD license.

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