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");
}
Important
This module is deprecated and will not receive any updates anymore. Please use @csstools/postcss-font-format-keywords instead.
npm install @csstools/postcss-font-format-keywords
npm install postcss-font-format-keywords
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);
Keep the original CSS declaration alongside the transformed one.
@font-face {
src: url(file.woff2) format("woff2");
src: url(file.woff2) format(woff2);
}