parse-css-font

Parse the CSS font property value.

MIT 10 个版本
安装
npm install parse-css-font
yarn add parse-css-font
pnpm add parse-css-font
bun add parse-css-font
README

parse-css-font

NPM version npm license Travis Build Status codecov BundlePhobia Minified Unicorn Approved

npm

Parses the CSS font property.

Installation

$ npm install parse-css-font [--save[-dev]]

Usage

const parseCSSFont = require('parse-css-font')
parseCSSFont('1rem "Roboto Condensed", sans-serif;')
/*
{
	size: '1rem',
	family: ['Roboto Condensed', 'sans-serif'],
	style: 'normal',
	variant: 'normal',
	weight: 'normal',
	stretch: 'normal',
	lineHeight: 'normal'
}
*/

See the tests for more scenarios.

ES6/2015 import

import parseCSSFont from 'parse-css-font'

Testing

$ npm test

This will run tests and generate a code coverage report. Anything less than 100% coverage will throw an error.

版本列表
4.0.0 2019-01-28
3.0.4 2019-01-28
3.0.3 2019-01-28
3.0.2 2018-05-21
3.0.1 2018-05-04
3.0.0 2018-05-04
2.0.2 2015-10-02
2.0.1 2015-10-02
2.0.0 2015-10-02
1.0.0 2015-09-27