Answered: How to use rel="preload" for stylesheet ?

Post date: 2020-07-02 01:47:34
Views: 101

Is this for the main Q2A stylesheet, or for some custom styles? I don't think adding preload makes any difference for the main stylesheet - you want to load it as soon as you get to it, not asynchronously.

But it can be done in your theme. Probably the best function to override would be head_title() as that comes near the beginning of <head>

public function head_title()
{
    $this->output('<link rel="preload" href="stylesheet.css" as="style" onload="this.rel='stylesheet'">');
    parent::head_title();
}

Please click Here to read the full story.
 
Other Top and Latest Questions:
Oil edges higher as U.S. weighs added sanctions on Iran oil exports after attack on Israel
The salary a single person needs to live comfortably in every U.S. state
Incredibly middle-aged question about home appraisal, taxes, blah
Meaningful birthday gift for 10yo (first of series) ?
Work is an infinite spiral of ennui and tedium. Someone help me.
If this is a stock market correction, here's how history says it will unfold
Lagarde says ECB will cut rates soon, barring any major surprises; notes 'extremely attentive' to oil
Sen. Tom Cotton encourages drivers to drag Gaza cease-fire protestors from blocked roads
AMD rolls out its latest chips for AI PCs as competition with Nvidia and Intel heats up
With the market oversold, we're buying a geopolitical hedge and an unfairly punished beer stock