perf: improve LCP — move font loading to HTML, defer logo preload

- Move Google Fonts from CSS @import (render-blocking) to <link> in
  index.html with preconnect for earlier discovery
- Remove @import from globals.css — browser no longer waits for CSS
  parse -> @import fetch -> font CSS parse before first paint
- Defer initLogoPreload() to requestIdleCallback so logo fetch
  doesn't compete with critical resources during page load
This commit is contained in:
Fringg
2026-02-25 08:19:26 +03:00
parent 44d88f7653
commit 962dd43756
3 changed files with 12 additions and 4 deletions

View File

@@ -12,6 +12,12 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="format-detection" content="telephone=no" /> <meta name="format-detection" content="telephone=no" />
<title>Loading...</title> <title>Loading...</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap"
rel="stylesheet"
/>
<script src="https://telegram.org/js/telegram-web-app.js"></script> <script src="https://telegram.org/js/telegram-web-app.js"></script>
<style> <style>
body { body {

View File

@@ -92,8 +92,12 @@ if (!alreadyInitialized) {
} }
} }
// Preload logo from cache immediately on page load // Preload logo from cache — defer to idle time so it doesn't compete with LCP
initLogoPreload(); if ('requestIdleCallback' in window) {
requestIdleCallback(() => initLogoPreload());
} else {
setTimeout(initLogoPreload, 100);
}
const queryClient = new QueryClient({ const queryClient = new QueryClient({
defaultOptions: { defaultOptions: {

View File

@@ -1,5 +1,3 @@
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;