Provides fallbacks for loading fonts with webfontloader
npm install postcss-webfontloaderProvides fallbacks for loading fonts with [webfontloader][].
``sh`
yarn add postcss-webfontloader
`js`
// postcss.config.js
module.exports = {
plugins: {
'postcss-webfontloader': {
modules: false,
families: [
'Lora',
],
},
},
}
`css
/ base.css /
body {
font-family: Lora, Georgia, serif;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Helvetica Neue", Helvetica, sans-serif;
}
`
`css
/ base.css /
body {
font-family: Georgia, serif;
}
.wf-active body {
font-family: Lora, Georgia, serif;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Helvetica Neue", Helvetica, sans-serif;
}
`
If you're using CSS Modules, set modules to true to get the following output:
`css
/ base.css /
body {
font-family: Georgia, serif;
}
:global(.wf-active) body {
font-family: Lora, Georgia, serif;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Helvetica Neue", Helvetica, sans-serif;
}
``
[webfontloader]: https://github.com/typekit/webfontloader