blog/frontend/static/js/font-loader.js
SquidSpirit 18f29655bf
All checks were successful
Frontend CI / build (push) Successful in 1m10s
BLOG-92 Fix improve google font loading efficiency (#111)
### Description

Reference: https://web.dev/learn/performance/understanding-the-critical-path?utm_source=lighthouse&utm_medium=lr&hl=zh-tw#render-blocking_resources/

### Package Changes

_No response_

### Screenshots

_No response_

### Reference

Resolves #92

### Checklist

- [x] A milestone is set
- [x] The related issuse has been linked to this branch

Reviewed-on: #111
Co-authored-by: SquidSpirit <squid@squidspirit.com>
Co-committed-by: SquidSpirit <squid@squidspirit.com>
2025-08-02 15:26:49 +08:00

8 lines
208 B
JavaScript

// Defer loading of fonts to improve performance
window.addEventListener('load', function() {
const fontLink = document.getElementById('google-fonts');
if (fontLink) {
fontLink.media = 'all';
}
});