perf(fonts): Self-host Poppins fonts

- Add WOFF2 font files for Poppins (400, 500, 600, 700 weights)
- Create @font-face declarations in css-global-fonts.css
- Remove Google Fonts dependency from enqueue-scripts.php
- Remove preconnect hints for fonts.googleapis.com from seo.php

Benefits:
- Eliminates 36.2 kB external transfer from Google Fonts
- Improves GDPR compliance (no Google tracking)
- Reduces render-blocking requests
- Faster font loading from local server

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-11-26 22:26:16 -06:00
parent 9d14f38965
commit 8a49b19d00
7 changed files with 25 additions and 49 deletions

View File

@@ -13,23 +13,20 @@ if (!defined('ABSPATH')) {
/**
* Enqueue typography system
*
* SELF-HOSTED: Fuentes Poppins ahora se cargan desde Assets/fonts/
* Eliminada dependencia de Google Fonts para:
* - Mejorar rendimiento (sin requests externos)
* - Cumplimiento GDPR (sin tracking de Google)
* - Evitar bloqueo de renderizado
*/
function roi_enqueue_fonts() {
// Google Fonts - Poppins (según documentación INTRODUCCION.md)
wp_enqueue_style(
'google-fonts-poppins',
'https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap',
array(),
null,
'all'
);
// Fonts CSS local
// Fonts CSS local con @font-face para Poppins self-hosted
wp_enqueue_style(
'roi-fonts',
get_template_directory_uri() . '/Assets/css/css-global-fonts.css',
array('google-fonts-poppins'),
'1.0.0',
array(),
'1.1.0', // Bump version: self-hosted fonts
'all'
);
}

View File

@@ -113,19 +113,14 @@ function roi_seo_head_hooks() {
}
/**
* Add prefetch hints for external resources
* ELIMINADO: roi_prefetch_external()
*
* Improves performance by preemptively connecting to external domains
* commonly used in the theme (fonts, CDNs, etc.)
* Motivo: Fuentes Poppins ahora son self-hosted (Assets/fonts/)
* Ya no se necesita preconnect a Google Fonts
*
* @since 1.0.0
* @since 1.0.0 - Creado
* @since 1.1.0 - Eliminado (self-hosted fonts)
*/
function roi_prefetch_external() {
// Google Fonts prefetch
echo '<link rel="preconnect" href="https://fonts.googleapis.com">' . "\n";
echo '<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>' . "\n";
}
add_action('wp_head', 'roi_prefetch_external', 1);
/**
* Open Graph support for Rank Math compatibility