
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
css-font-face-src
Advanced tools
@font-face
rule src
field parser – css-font-face-src
A CSS @font-face src
property value parser.
Basically it provides two operations:
parse
: To convert a CSS property string to an array of easily readable objects. Each object either describes a local font (referenced using its family name) or a remote font (referenced using its URL).serialize
: To convert an object array back to a CSS property string.require
)const parser = require('css-font-face-src');
console.log(parser.parse('local("The Font"), url("font.otf") format("opentype"), url("font.woff"), local("Another Font")'));
will return:
[
{ local: 'The Font' },
{ url: 'font.otf', format: 'opentype' },
{ url: 'font.woff' },
{ local: 'Another Font' }
]
const parser = require('css-font-face-src');
console.log(
parser.serialize([
{ local: 'The Font' },
{ url: 'font.otf', format: 'opentype' },
{ url: 'font.woff' },
{ local: 'Another Font' }
])
);
will return:
'local("The Font"), url("font.otf") format("opentype"), url("font.woff"), local("Another Font")'
import
)import { parse } from 'css-font-face-src';
console.log(parse('local("The Font"), url("font.otf") format("opentype"), url("font.woff"), local("Another Font")'));
will return:
[
{ local: 'The Font' },
{ url: 'font.otf', format: 'opentype' },
{ url: 'font.woff' },
{ local: 'Another Font' }
]
import { serialize } from 'css-font-face-src';
console.log(
serialize([
{ local: 'The Font' },
{ url: 'font.otf', format: 'opentype' },
{ url: 'font.woff' },
{ local: 'Another Font' }
])
);
will return:
'local("The Font"), url("font.otf") format("opentype"), url("font.woff"), local("Another Font")'
import { parse } from 'css-font-face-src';
console.log(parse('local("The Font"), url("font.otf") format("opentype"), url("font.woff"), local("Another Font")'));
will return:
[
{ local: 'The Font' },
{ url: 'font.otf', format: 'opentype' },
{ url: 'font.woff' },
{ local: 'Another Font' }
]
import { serialize, FontFaceSrcItem } from 'css-font-face-src';
console.log(
serialize([
{ local: 'The Font' },
{ url: 'font.otf', format: 'opentype' },
{ url: 'font.woff' },
{ local: 'Another Font' }
] as FontFaceSrcItem[])
);
will return:
'local("The Font"), url("font.otf") format("opentype"), url("font.woff"), local("Another Font")'
Christoph Burgmer. Licensed under BSD-2-Clause. Reach out on Twitter.
FAQs
A CSS @font-face src property value parser
The npm package css-font-face-src receives a total of 18,290 weekly downloads. As such, css-font-face-src popularity was classified as popular.
We found that css-font-face-src demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.