N°3685 Preload necessary fonts to speed up display

This commit is contained in:
Stephen Abello
2021-09-15 09:58:59 +02:00
committed by Molkobain
parent 61ee4d6807
commit b1b1d25186
4 changed files with 46 additions and 1 deletions

View File

@@ -20,6 +20,31 @@ use utils;
*/
class WebResourcesHelper
{
//---------------------------------
// Fonts
//---------------------------------
/**
* Preload necessary fonts to display them as soon as possible when CSS rules are interpreted
*
* @return string[]
*
* @throws \Exception
*/
public static function GetPreloadedFonts(): array
{
return [
['font' => utils::GetAbsoluteUrlAppRoot().'css/font-combodo/combodo-webfont.woff2', 'type' => 'woff2'],
['font' => utils::GetAbsoluteUrlAppRoot().'css/font-awesome/webfonts/fa-solid-900.woff2', 'type' => 'woff2'],
['font' => utils::GetAbsoluteUrlAppRoot().'node_modules/@fontsource/raleway/files/raleway-all-400-normal.woff', 'type' => 'woff'],
['font' => utils::GetAbsoluteUrlAppRoot().'node_modules/@fontsource/raleway/files/raleway-all-500-normal.woff', 'type' => 'woff'],
['font' => utils::GetAbsoluteUrlAppRoot().'node_modules/@fontsource/raleway/files/raleway-all-600-normal.woff', 'type' => 'woff'],
['font' => utils::GetAbsoluteUrlAppRoot().'node_modules/@fontsource/raleway/files/raleway-all-700-normal.woff', 'type' => 'woff'],
['font' => utils::GetAbsoluteUrlAppRoot().'node_modules/@fontsource/raleway/files/raleway-all-400-italic.woff', 'type' => 'woff'],
['font' => utils::GetAbsoluteUrlAppRoot().'node_modules/@fontsource/raleway/files/raleway-all-500-italic.woff', 'type' => 'woff'],
];
}
//---------------------------------
// CKEditor
//---------------------------------