fixed typographic traitment, moved js alog to header defer script for speed, no more flickering

This commit is contained in:
2026-09-11 21:36:42 +02:00
parent 4efafd0e22
commit 9dc1272631
10 changed files with 268 additions and 182 deletions
+21
View File
@@ -12,8 +12,29 @@ function leshed_page_attachments_alter(&$page) {
// $attachments['#attached']['html_head'][] = [['src' => 'http://localhost:5173/assets/js/main.js', 'type' => 'module'],'vite-main'];
// $page['#attached']['library'][] = 'http://localhost:5173/assets/js/main.js';
$page['#attached']['library'][] = 'leshed/vitehmr';
$page['#attached']['library'][] = 'leshed/titles_hmr';
}else{
$page['#attached']['library'][] = 'leshed/global';
$page['#attached']['library'][] = 'leshed/titles';
// Must match exactly the url() resolved from assets/dist/main.css, or the
// font is downloaded twice.
$fonts_path = base_path() . \Drupal::service('extension.list.theme')->getPath('leshed') . '/assets/dist/fonts/';
foreach (['Epilogue-VariableFont_wght.ttf', 'Epilogue-Italic-VariableFont_wght.ttf'] as $font) {
$page['#attached']['html_head'][] = [
[
'#tag' => 'link',
'#attributes' => [
'rel' => 'preload',
'href' => $fonts_path . $font,
'as' => 'font',
'type' => 'font/ttf',
'crossorigin' => 'anonymous',
],
],
'leshed_preload_' . $font,
];
}
}
}
/**