Does anyone here try to preload CSS on XF 2.1?

rdn

Well-known member
By editing helper_js_global template:

and replace
<link rel="stylesheet" href="{{ css_url($cssUrls) }}" />
with
<link rel="preload" href="{{ css_url($cssUrls) }}" as="style">
 
You'd need both tags I'm pretty sure, the preload directive doesn't replace the stylesheet directive. Since they're likely to come one after another, I'd imagine any performance benefit would be negligible, but I haven't tested to be sure. In reading the MDN documentation, it seems like it's more useful for resources that wouldn't otherwise be discovered until later in the loading process.
 
Back
Top Bottom