css-font-parser
A parser for the CSS font value
Last updated 5 years ago by bramstein .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ npm install css-font-parser 
SYNC missed versions from official npm registry.

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:

npm install css-font-parser

Usage

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.

Current Tags

  • 2.0.0                                ...           latest (2 years ago)

7 Versions

  • 2.0.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.3                                ...           7 years ago
  • 0.2.2                                ...           7 years ago
  • 0.2.1                                ...           9 years ago
  • 0.2.0                                ...           11 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE