[WordPress] 外掛分享: Page Optimize

首頁外掛目錄 › Page Optimize
200,000+
安裝啟用
★★★☆☆
3/5 分(5 則評價)
34 天前
最後更新
問題解決
WordPress 5.3+ PHP 7.4+ v0.6.2 上架:2020-02-26

內容簡介

此外掛支援幾項功能,有助於提升頁面載入及瀏覽器渲染的效能:

合併 CSS
合併 JavaScript
延後非關鍵性腳本的執行時間

注意:變更腳本執行時間可能會有風險,並非適用於所有網站。

測試

若要在整個網站啟用之前測試這些功能,您可以在 WordPress 文章或頁面的 URL 後方加上查詢參數。例如,若要在 https://example.com/blog/ 上測試啟用 JavaScript 合併,您可以使用 URL https://example.com/blog/?concat-js=1。

支援的查詢參數:

concat-css 控制 CSS 合併。值: 1 為開啟,0 為關閉。
concat-js 控制 JavaScript 合併。值: 1 為開啟,0 為關閉。
load-mode-js 控制非關鍵性 JavaScript 的載入模式。值:‘defer’ 為延後載入,async 為 非同步載入,任何其他值都表示此功能應被停用。

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.6.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Page Optimize」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin supports a few features that may improve the performance of page loading and rendering in the browser:

Concatenate CSS
Concatenate JavaScript
Execution timing of non-critical scripts

Note: Changing script execution timing can be risky and will not work well for all sites.

Testing
To test features without enabling them for the entire site, you may append query params to a WordPress post or page URL. For example, to test enabling JavaScript concatenation for https://example.com/blog/, you can use the URL https://example.com/blog/?concat-js=1.
Supported query params:

concat-css controls CSS concatenation. Values: 1 for ON and 0 for OFF.
concat-js controls JavaScript concatenation. Values: 1 for ON and 0 for OFF.
load-mode-js controls how non-critical JavaScript are loaded. Values: ‘defer’ for deferred, ‘async’ for async loading, any other value indicates the feature should be disabled.

PHPUnit (Docker)
You can run the PHPUnit tests locally using Docker (no local MySQL required).
First time (or after changing DB credentials):
docker compose down -v

Run tests:
docker compose up --build --abort-on-container-exit --exit-code-from tests

Optional overrides (examples):

WP_VERSION=6.5 docker compose up --build --abort-on-container-exit --exit-code-from tests
PHP_VERSION=7.4 docker compose up --build --abort-on-container-exit --exit-code-from tests
PHPUNIT_VERSION=9.6.20 docker compose up --build --abort-on-container-exit --exit-code-from tests

延伸相關外掛

文章
Filter
Apply Filters
Mastodon