內容簡介
您是否讀過有關通過在 head 部分中排序樣式和腳本來優化網站/部落格的文章?
如果您希望您的網站在瀏覽器中能夠盡快加載,那麼您可能已經閱讀過性能優化提示,其中建議在 HTML head 部分 <head></head> 中將所有 CSS 文件放在頂部,腳本文件則放在最後。
您怎樣排序這些調用?如果您手動將 CSS 和 JavaScript 文件放在頭部(<head></head>)中,
那麼您可以非常容易地進行這樣的操作。只需更改一次,此優化即可完成。
如果您使用添加動態 JavaScript 和 CSS 文件的插件,該怎麼辦?這是 WordPress 博客的情況,
我們使用許多插件,這些插件從 wp_head() 調用中動態添加各種樣式和腳本文件。
如果以上內容對您來說不太清晰,那麼您可能還沒有閱讀有關 Google 的文檔。
該插件還可以將不同的內置腳本收集到一個地方,從而使源代碼更加清晰。
為了檢查插件是否起作用,請在啟用插件之前和之後比較 Head 部分。
(如需閱讀更多詳細討論,請點擊右側的插件鏈接。)
作者(satya61229)有關 WP 的介紹頁面
外掛標籤
開發者團隊
② 後台搜尋「Performance Optimization: Order Styles and Javascript」→ 直接安裝(推薦)
原文外掛簡介
Did you ever read about Optimization of website/blog through ordering styles and Scripts in head section?
If you like your website load in browser as quickly as possible then you may have read in performance optimization tips that
you should move all CSS files on top and script at last in HTML head section
How do you order those calls? If you are manually putting CSS and JavaScript files in head section (),
then you can do this very easily. Just modify once and optimization for this is over.
What if you are using plugins and that are adding calls to JavaScript and CSS files dynamically. This is case of WordPress blog,
where we use many plugins and those plugins add various Styles and Script files dynamically from wp_head() call.
If above lines, do not makes much sense to you then probably you have not
read this documentation on Google.
The plugin will also collect different inline scripts to one place. Thus making the source code
look better.
To check, if the plugin is doing anything or not, compare the Head section before and after
activating the plugin.
(For reading more details discussion, follow the Plugin link on right side.)
Author (satya61229) About page on WP
