0.3.0 • Published 3 years ago

postcss-font-display v0.3.0

Weekly downloads
693
License
MIT
Repository
github
Last release
3 years ago

PostCSS Font Display Build Status

PostCSS plugin to automatically add font-display css rule.

@font-face {
    /* Input example */
    font-family: 'My Font';
}
@font-face {
    /* Output example */
    font-family: 'My Font';
    font-display: swap;
}

Install

With npm do:

npm install postcss-font-display --save

Usage

postcss([ require('postcss-font-display')({ display: 'swap', replace: false }) ])

Advanced usage

postcss([ require('postcss-font-display')([
  { display: 'swap', replace: false },
  { test: 'FontAwesome', display: 'block' },
]) ])

Options

OptionTypeDefaultDescription
testRegExpfalseText pattern for font-family css rule
displayStringswapValue for new font-display css rule
replaceBooleanfalseReplace exists font-display rule

See PostCSS docs for examples for your environment.