perf(pagespeed): Preload todas las fuentes + diferir CSS no críticos

Fase 4.3 optimización CLS:
- Preload Poppins 400, 500, 600, 700 (antes solo 400, 600)
- Preload bootstrap-icons font
- Diferir: bootstrap-icons, accessibility, responsive, utilities CSS

Objetivo: CLS 0.109 → ≤0.10, Performance 96 → 100

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-11-27 16:00:57 -06:00
parent 83717771c0
commit 23a3c4d074
2 changed files with 36 additions and 9 deletions

View File

@@ -348,18 +348,36 @@ function roi_preload_critical_resources() {
esc_url( $theme_uri . '/Assets/css/css-global-fonts.css' )
);
// Fase 4.3 PageSpeed: Preload de fuentes Poppins críticas
// Fase 4.3 PageSpeed: Preload de TODAS las fuentes Poppins para eliminar CLS
// Regular (400) - texto del body
printf(
'<link rel="preload" href="%s" as="font" type="font/woff2" crossorigin>' . "\n",
esc_url( $theme_uri . '/Assets/fonts/poppins-v24-latin-regular.woff2' )
);
// Medium (500) - usado en algunos elementos
printf(
'<link rel="preload" href="%s" as="font" type="font/woff2" crossorigin>' . "\n",
esc_url( $theme_uri . '/Assets/fonts/poppins-v24-latin-500.woff2' )
);
// Semibold (600) - headings y elementos destacados
printf(
'<link rel="preload" href="%s" as="font" type="font/woff2" crossorigin>' . "\n",
esc_url( $theme_uri . '/Assets/fonts/poppins-v24-latin-600.woff2' )
);
// Bold (700) - títulos principales
printf(
'<link rel="preload" href="%s" as="font" type="font/woff2" crossorigin>' . "\n",
esc_url( $theme_uri . '/Assets/fonts/poppins-v24-latin-700.woff2' )
);
// Bootstrap Icons font
printf(
'<link rel="preload" href="%s" as="font" type="font/woff2" crossorigin>' . "\n",
esc_url( $theme_uri . '/Assets/Vendor/fonts/bootstrap-icons-subset.woff2' )
);
}
add_action( 'wp_head', 'roi_preload_critical_resources', 2 );