Skip to content

PostCSS plugin to automatically add font-display css rule

License

Notifications You must be signed in to change notification settings

dkrnl/postcss-font-display

Repository files navigation

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.

About

PostCSS plugin to automatically add font-display css rule

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published