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;
}
With npm do:
npm install postcss-font-display --save
postcss([ require('postcss-font-display')({ display: 'swap', replace: false }) ])
postcss([ require('postcss-font-display')([
{ display: 'swap', replace: false },
{ test: 'FontAwesome', display: 'block' },
]) ])
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.