I did so by adding
Code: Select all
rel="preload" as="style" onload="this.rel = 'stylesheet'"
However, I noticed that there were some other local resources that were still being loaded regularly. I was able to narrow it down to the assets_bag.php file and made the following changes:
Code: Select all
/**
* Returns the HTML code to includes all css assets
*
* @return string
*/
public function get_stylesheets_content()
{
$output = '';
foreach ($this->stylesheets as $stylesheet)
{
$output .= "<link href=\"{$stylesheet->get_url()}\" rel=\"preload\" as=\"style\" onload=\"this.rel='stylesheet'\" media=\"screen\" >\n";
}
return $output;
}
/**
* Returns the HTML code to includes all js assets
*
* @return string
*/
public function get_scripts_content()
{
$output = '';
foreach ($this->scripts as $script)
{
$output .= "<link href=\"{$script->get_url()}\" rel=\"preload\" as=\"script\">\n";
}
return $output;
}
}
Would this be something that would be included in the next feature version or regular version?