[wordpress插件] Async JS and CSS异步JS和CSS

wordpress 插件 文章 2020-02-22 11:00 532 0 全屏看文

AI助手支持GPT4.0

评分
84
描述

When your page is loaded by browser – all that stuff placed in HEAD tag is loaded before the page content – in blocking way.

通过浏览器加载页面时-放置在HEAD标记中的所有内容都在页面内容之前加载-处于阻塞状态。

So the content is delivered to user in the last moment, after all javascript and css files are loaded.

因此,所有的javascript和css文件加载完毕后,内容就会在最后一刻交付给用户。

If you are a webmaster or just want to make your web to make better your positions on search engines (yes, they preffer faster webs), just take a look on Google PageSpeed Insights – you'll see that one of the mos

如果您是网站站长,或者只是想让自己的网站在搜索引擎中占据更好的位置(是的,他们认为自己的网站速度更快),那么请看一下Google PageSpeed Insights –您会发现其中之一

important things is fastenes and one of the reason why your page is not so fast – is “Render-blocking JavaScript and CSS”.

重要的事情是Fastenes,而您的页面不能这么快的原因之一就是“渲染阻止JavaScript和CSS”。

This plugin makes ALL scripts loaded by other plugins to be loaded in asynchronous way just like Google PageSpeed Insights recommends.

此插件可以使所有其他插件加载的脚本以异步方式加载,就像Google PageSpeed Insights建议的那样。

All CSS files will be inserted inline into the document code or moved from the document beginning to the end, just before closing BODY tag (or just where you placed wp_foot() function).

所有CSS文件都将内联插入到文档代码中,或者从文档开始到结尾移动,恰好在关闭BODY标记之前(或在放置wp_foot()函数的位置)。

There are various methods to do that – they are all in plugin’s configuration page.

有多种方法可以做到–它们都在插件的配置页面中。

Plugin makes all scripts to be loaded asynchronously using wp_enqueue_script and also can detect scrips included inside of wp_head and wp_footer hooks.

插件使所有脚本都可以使用wp_enqueue_script异步加载,并且还可以检测wp_head和wp_footer挂钩中包含的脚本。

All CSS files loaded using wp_enqueue_style can be loaded just before closing BODY tag by four methods:

使用wp_enqueue_style加载的所有CSS文件都可以在关闭BODY标记之前通过以下四种方法加载:

* inserting  tag

  *插入标签

* inserting

*插入