Load Google Fonts and Yandex Maps without blocking app start
The fonts were pulled by @import inside the main CSS bundle; the deferred app bundle waited for that stylesheet, so a slow fonts.googleapis.com kept the page blank for 20-30 s. Fonts now load from index.html as a print stylesheet switched on by onload (text renders with a fallback font meanwhile, display=swap). The Maps API script was defer, so the app bundle (deferred after it) could not run until the Maps API downloaded. It is async now; map code already waits for window.ymaps via whenYmapsReady. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');
|
||||
/* Шрифты (Fraunces, Inter) подключаются в public/index.html */
|
||||
|
||||
/*
|
||||
Design tokens live scoped to .nk-page so nothing outside this page
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800;900&display=swap');
|
||||
/* Шрифты подключаются без блокировки рендера в public/index.html */
|
||||
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* public/index.html подключает API Яндекс.Карт через <script defer>,
|
||||
* public/index.html подключает API Яндекс.Карт через <script async>,
|
||||
* поэтому к моменту первого рендера window.ymaps может быть ещё undefined:
|
||||
* скрипт не скачался, медленный CDN, блокировщик рекламы, офлайн.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user