TheFlow
073cfabd97
perf(docs): improve LCP with deferred scripts and font preloading
SUMMARY:
Optimized docs.html performance to improve Lighthouse score from 89/100
to >90/100 and reduce LCP from 1.8s to <1.5s.
PERFORMANCE OPTIMIZATIONS:
1. Deferred Script Loading:
- Added defer attribute to 5 scripts (lines 865, 867-869, 872-873)
- version-manager.js
- document-cards.js
- docs-app.js
- docs-search-enhanced.js
- i18n-simple.js
- language-selector.js
- Scripts now download in parallel without blocking HTML parsing
- Execute in order after DOM ready
2. Font Preloading:
- Added preload hints for critical fonts (lines 24-25)
- Inter Regular (400) - body text
- Inter Bold (700) - headings
- Browser starts downloading fonts immediately
- Reduces FOIT/FOUT (flash of invisible/unstyled text)
EXPECTED IMPACT:
- LCP improvement: 1.8s → <1.5s (expected 15-20% reduction)
- Performance score: 89/100 → >90/100
- Scripts no longer block initial render
- Fonts render faster with less layout shift
- Reduced critical request chain length
LIGHTHOUSE ISSUES ADDRESSED:
✓ Render-blocking scripts eliminated
✓ Font loading optimized with preload hints
✓ Critical resources prioritized
FILES MODIFIED:
- public/docs.html (added defer to 6 scripts, preload 2 fonts)
NEXT STEPS:
Deploy to production and run Lighthouse audit to verify improvements.
🤖 Generated with Claude Code (https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>