postcss-font-display

0.3.0 • Public • Published

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

Option Type Default Description
test RegExp false Text pattern for font-family css rule
display String swap Value for new font-display css rule
replace Boolean false Replace exists font-display rule

See PostCSS docs for examples for your environment.

Package Sidebar

Install

npm i postcss-font-display

Weekly Downloads

782

Version

0.3.0

License

MIT

Unpacked Size

5.31 kB

Total Files

5

Last publish

Collaborators

  • dkrnl