admin管理员组

文章数量:1124674

I've placed the critical CSS between im. If I understood correctly, the non-critical CSS, the remainder remaining in the style.css) must now be loaded with a delay. A tutorial said I had to add the preload attribute to the. Per script in the functions.php. I tried the following, but it didn't work, a preload attribute wasn't set.

    function wpnoob_enqueue_styles() {
wp_enqueue_style('preload-style', 'styyle.css', false, null);
add_filter('style_loader_tag', 'wpnoob_preload_filter', 10, 2);

}

function wpnoob_preload_filter($html, $handle) { if ($handle === 'preload-style') { $html = str_replace("rel='stylesheet'", "rel='preload' as='style'", $html); } return $html;

However, I'm not sure why it should get "preload" either. Actually, the non-critical style.css should be able to be loaded later now so that it is not render-blocking? With a "defer" attribute? Can anyone tell me how to do this correctly? I'm also happy about a link to a tutorial... :) Thank You!

本文标签: How to Inline Critical CSS Correctly