Skip to main content

PostCSS Font Format Keywords PostCSS

deno.land NPM License

This PostCSS plugin lets you specify font formats as keywords, following the CSS Fonts specification.

@font-face {
    src: url(file.woff2) format(woff2);
}

/* becomes */

@font-face {
    src: url(file.woff2) format("woff2");
}

Usage

Deno

Import the module:

import postcss from 'npm:postcss';
import formatKeywords from 'https://deno.land/x/postcss_font_format_keywords@4.0.1/mod.js';

await postcss([formatKeywords]).process(YOUR_CSS);

Node.js

Add the package in your project:

npm install postcss-font-format-keywords

Then import or require it:

import postcss from 'postcss';
import formatKeywords from 'postcss-font-format-keywords';
// OR
const postcss = require('postcss');
const formatKeywords = require('postcss-font-format-keywords');

await postcss([formatKeywords]).process(YOUR_CSS);

Options

preserve: true

Keep the original CSS declaration alongside the transformed one.

@font-face {
    src: url(file.woff2) format("woff2");
    src: url(file.woff2) format(woff2);
}