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
版权声明:本文标题:How to Inline Critical CSS Correctly 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736642945a1946038.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论