node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

parse-css-font

parse-css-font

NPM version npm license Travis Build Status

npm

Parses the CSS font property.

Installation

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

Usage

var 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.

Testing

$ npm test

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