|
1 | 1 | <div align="center">
|
2 | 2 | <img src="https://res.cloudinary.com/dazdt97d3/image/upload/c_scale,q_auto:best,w_200/v1606558223/omni-logo.jpg" alt="Omni font loader logo">
|
3 | 3 | <br/><br/>
|
4 |
| -<h1>Gatsby Omni Font Loader</h1> |
| 4 | +<h1>Gatsby Omni Font Loader v2</h1> |
5 | 5 | </div>
|
6 | 6 |
|
7 | 7 | - Simple way to add webfonts or custom fonts to Gatsby project
|
@@ -106,12 +106,12 @@ Add the following snippet to `gatsby-config.js` plugins array.
|
106 | 106 | <td>false</td>
|
107 | 107 | </tr>
|
108 | 108 | <tr>
|
109 |
| - <td>interval</td> |
| 109 | + <td>interval <strong>(V1 ONLY)</strong></td> |
110 | 110 | <td>Works if <code>enableListener</code> is <code>true</code>. Font listener interval (in ms). Default is 300ms. Recommended: >=300ms. </td>
|
111 | 111 | <td>300</td>
|
112 | 112 | </tr>
|
113 | 113 | <tr>
|
114 |
| - <td>timeout</td> |
| 114 | + <td>timeout <strong>(V1 ONLY)</strong></td> |
115 | 115 | <td>Works if <code>enableListener</code> is <code>true</code>. Font listener timeout value (in ms). Default is 30s (30000ms). Listener will no longer check for loaded fonts after timeout, fonts will still be loaded and displayed, but without handling FOUT.</td>
|
116 | 116 | <td>30000</td>
|
117 | 117 | </tr>
|
@@ -164,20 +164,24 @@ To avoid this, we can use CSS to style the fallback font to closely match the fo
|
164 | 164 |
|
165 | 165 | When `enableListener: true` is set in plugin config in `gatsby-config.js`, HTML classes are being added to `<body>` element as the fonts are being loaded.
|
166 | 166 |
|
167 |
| -HTML class name format will be in the following format `wf-[font-family-name]--loaded`. |
| 167 | +HTML class name format will be in the following format `wf-[font-family-name]`. When all fonts are loaded `wf-all` is applied. |
168 | 168 |
|
169 | 169 | You can use the [Font Style Matcher](https://meowni.ca/font-style-matcher/) to adjust the perfect fallback font and fallback CSS config.
|
170 | 170 |
|
171 | 171 | Here is the example of how `body` element will look like after all fonts are being loaded (depending on the config).
|
172 | 172 |
|
173 | 173 | ```html
|
174 | 174 | <body
|
175 |
| - class="wf-lazy-monday--loaded wf-font-awesome-5-brands--loaded wf-font-awesome-5-free--loaded wf-staatliches--loaded wf-henny-penny--loaded" |
| 175 | + class="wf-lazy-monday wf-font-awesome-5-brands wf-font-awesome-5-free wf-staatliches wf-all" |
176 | 176 | ></body>
|
177 | 177 | ```
|
178 | 178 |
|
179 | 179 | <img alt="FOUT example" src="https://res.cloudinary.com/dazdt97d3/image/upload/v1604140006/fouc.gif">
|
180 | 180 |
|
| 181 | +## V2 breaking changes |
| 182 | +* Removed `interval` and `timeout` options |
| 183 | +* Changed class name format to a more generic `wf-[font-family-name]` to avoid mixing naming conventions |
| 184 | + |
181 | 185 | ## Issues and Contributions
|
182 | 186 |
|
183 | 187 | Feel free to [report issues](https://github.com/codeAdrian/gatsby-omni-font-loader/issues) you find and feel free to contribute to the project by creating Pull Requests.
|
|
0 commit comments