Add the "async" parameter to script tags
In my testing this has improved my Page Insights score pretty significantly especially for mobile. See: https://web.dev/render-blocking-resources/
This commit is contained in:
parent
f46de71aa7
commit
12bbef14a6
|
@ -214,7 +214,7 @@ class Theme {
|
|||
|
||||
$scripts = '';
|
||||
foreach($files as $file) {
|
||||
$scripts .= '<script src="'.$base.$file.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
$scripts .= '<script async src="'.$base.$file.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
}
|
||||
|
||||
return $scripts;
|
||||
|
@ -248,12 +248,12 @@ class Theme {
|
|||
|
||||
public static function jquery()
|
||||
{
|
||||
return '<script src="'.DOMAIN_CORE_JS.'jquery.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
return '<script async src="'.DOMAIN_CORE_JS.'jquery.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
}
|
||||
|
||||
public static function jsBootstrap()
|
||||
{
|
||||
return '<script src="'.DOMAIN_CORE_JS.'bootstrap.bundle.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
return '<script async src="'.DOMAIN_CORE_JS.'bootstrap.bundle.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
}
|
||||
|
||||
public static function cssBootstrap()
|
||||
|
@ -269,7 +269,7 @@ class Theme {
|
|||
public static function jsSortable()
|
||||
{
|
||||
// https://github.com/psfpro/bootstrap-html5sortable
|
||||
return '<script src="'.DOMAIN_CORE_JS.'jquery.sortable.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
return '<script async src="'.DOMAIN_CORE_JS.'jquery.sortable.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue