postcss-webfontloader

0.0.1 • Public • Published

postcss-webfontloader

Provides fallbacks for loading fonts with webfontloader.

Setup

yarn add postcss-webfontloader
// postcss.config.js
module.exports = {
  plugins: {
    'postcss-webfontloader': {
      modules: false,
      families: [
        'Lora',
      ],
    },
  },
}

Basic usage

Input

/* base.css */
body {
  font-family: Lora, Georgiaserif;
}
 
h1h2h3h4h5h6 {
  font-family: "Helvetica Neue"Helveticasans-serif;
}

Output

/* base.css */
body {
  font-family: Georgiaserif;
}
.wf-active body {
  font-family: Lora, Georgiaserif;
}
 
h1h2h3h4h5h6 {
  font-family: "Helvetica Neue"Helveticasans-serif;
}

Output for CSS Modules

If you're using CSS Modules, set modules to true to get the following output:

/* base.css */
body {
  font-family: Georgiaserif;
}
:global(.wf-active) body {
  font-family: Lora, Georgiaserif;
}
 
h1h2h3h4h5h6 {
  font-family: "Helvetica Neue"Helveticasans-serif;
}

Package Sidebar

Install

npm i postcss-webfontloader

Weekly Downloads

5

Version

0.0.1

License

MIT

Unpacked Size

5.65 kB

Total Files

8

Last publish

Collaborators

  • silvenon