postcss-font-display
v0.3.0
Published
PostCSS plugin add font-display css rule
Downloads
6,259
Maintainers
Readme
PostCSS Font Display
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.