Skip to content

Commit 936a92b

Browse files
Merge pull request #4309 from IgorA100/patch-727722
Feat: Added "preload" for "fontawesome-webfont.woff2" (functions.php)
2 parents 13b218b + a662503 commit 936a92b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

web/skins/classic/includes/functions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function xhtmlHeadersStart($file, $title) {
6868
echo output_link_if_exists(array('fonts/material-icons.woff2'), false, $param = ['global', 'preload', ' as="font" type="font/woff2" crossorigin']);
6969
//echo output_link_if_exists(array('fonts/material-icons.woff'), false, $param = ['global', 'preload', ' as="font" type="font/woff" crossorigin']);
7070
echo output_link_if_exists(array('css/base/material-icons.css'), false);
71+
echo output_link_if_exists(array('fonts/fontawesome-webfont.woff2?v=4.7.0'), false, $param = ['global', 'preload font', ' as="font" type="font/woff2" crossorigin']);
7172
echo output_script_if_exists(array(
7273
'js/fontfaceobserver.standalone.js',
7374
));
@@ -195,7 +196,8 @@ function output_link_if_exists($files, $cache_bust=true, $param=false) {
195196
$suffix = ' type="text/css"';
196197
}
197198
foreach ( $files as $file ) {
198-
$file_ = ($global_file && file_exists($file)) ? $file : getSkinFile($file);
199+
// The file name can be for example "fontawesome-webfont.woff2?v=4.7.0". We need to select what is before the "?"
200+
$file_ = ($global_file && file_exists(explode('?', $file)[0])) ? $file : getSkinFile($file);
199201
if ($file_) {
200202
if ( $cache_bust ) {
201203
$html[] = '<link rel='.$rel.' href="'.cache_bust($file_).'" '.$suffix.'/>';

0 commit comments

Comments
 (0)