前言介紹
- 這款 WordPress 外掛「Dependency Minification」是 2013-08-06 上架。
- 目前有 30 個安裝啟用數。
- 上一次更新是 2015-02-25,距離現在已有 4019 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 3.5 以上版本才可以安裝。
- 有 11 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
xwp | kucrut | lkraav | alex-ye | shadyvb | fjarrett | c3mdigital | westonruter |
外掛標籤
minify | compress | concatenate | performance | dependencies |
內容簡介
此外掛會自動將使用wp_enqueue_script 及 wp_enqueue_style 加入的所有腳本和樣式表合併和縮小為邏輯組。例如,頁面底部的腳本會被分組,同樣媒體(例如print)的樣式表會一起縮小。縮小是通過WP-Cron完成的,以避免競態條件並確保縮小過程不會減慢頁面響應速度。
這是Optimize Scripts插件的重新設計和重寫,現在取代了該插件。
特點:
縮小來源存儲在WP選項表中,因此不需要特殊的文件系統訪問。
縮小請求的端點為/_minified,可以進行配置。
管理頁面用於盤點縮小的腳本和樣式表,提供過期或清除緩存數據的方法。
必須排除縮小的依賴關係可能會通過dependency_minification_excluded過濾器排除。
預設情況下,托管在其他域上的相依關係會被排除,但可以通過過濾器dependency_minification_options過濾default_exclude_remote_dependencies選項,或通過前面提到的過濾器根據情況進行更改。
預設情況下,外部腳本不會被合併和縮小,但可以通過dependency_minification_excluded過濾器設定。
縮小源的緩存時間默認為1個月,但可以通過cache_control_max_age_cache選項進行配置。
如果縮小源尚不可用,頁面源將註明等待依賴關係縮小過程。
任何在縮小過程中發生的錯誤都會在前端以注釋的形式顯示,如果已啟用show_error_messages選項,則此類錯誤默認情況下已啟用WP_DEBUG。
如果縮小過程出錯,原始未縮小的來源將被提供並且該錯誤將被緩存1小時(默認情況下,通過cache_control_max_age_error進行配置),以防止連續的cron的回溯不斷地嘗試進行縮小。
緩存的縮小源使用Last-Modified和ETag響應標頭提供,請求將憑藉If-None-Match和If-Modified-Since來返回304 Not Modified的響應(可通過選項allow_not_modified_responses進行配置)。
附加到腳本的數據(例如通過wp_localize_script附加到腳本)也會一起合併並附加到新縮小的腳本上。
使用WP-Cron來啟動縮小過程,以避免競態條件,並確保頁面響應速度不會減慢。
過時的縮小腳本和樣式表一直保留到刷新,這可以確保引用過時縮小源的完整頁面緩存不會導致任何404。
可以使用gzip或deflate服務壓縮響應。
轉換樣式表中的相對路徑(例如背景圖像)為絕對路徑,以便它們不會404。
此插件的開發在GitHub上完成。歡迎提交拉取請求。在前往插件論壇之前,請參閱在此報告的問題。如果使用Nginx與此外掛一起運行,請閱讀附加文檔以了解更多資訊。
原文外掛簡介
This plugin takes all scripts and stylesheets that have been added via wp_enqueue_script and wp_enqueue_style
and automatically concatenates and minifies them into logical groups. For example, scripts in the footer get grouped
together and styles with the same media (e.g. print) get minified together. Minification is done via WP-Cron in order
to prevent race conditions and to ensure that the minification process does not slow down page responses.
This is a reincarnation and rewrite of the Optimize Scripts plugin,
which this plugin now supersedes.
Features:
Minified sources are stored in the WP Options table so no special filesystem access is required.
Endpoint for minified requests is at /_minified, which can be configured.
Admin page for taking inventory of minified scripts and stylesheets, with methods for expiring or purging the cached data.
Dependencies which must not be minified may be excluded via the dependency_minification_excluded filter.
Dependencies hosted on other domains are by default excluded, but this behavior can be changed by filtering the default_exclude_remote_dependencies option via the dependency_minification_options filter, or on a case-by-case basis via the filter previously mentioned.
By default excludes external scripts from being concatenated and minified, but they can be opted in via the dependency_minification_excluded filter.
The length of time that a minified source is cached defaults to 1 month, but can be configured via the cache_control_max_age_cache option.
If a minified source is not available yet, the page source will note that the dependency minification process is pending.
Any errors that occur during minification will be shown on the frontend in comments if the show_error_messages option is enabled; such errors are enabled by default if WP_DEBUG.
If the minification process errors out, the original unminified sources are served and the error is cached for 1 hour (by default, configured via cache_control_max_age_error) to prevent back-to-back crons from continually attempting to minify in perpetuity.
Cached minified sources are served with Last-Modified and ETag responses headers and requests will honor If-None-Match and If-Modified-Since to return 304 Not Modified responses (configurable via the allow_not_modified_responses option).
Data attached to scripts (e.g. via wp_localize_script) is also concatenated together and attached to the newly-minified script.
WP-Cron is utilized to initiate the minification process in order to prevent race conditions, and to ensure that page responses aren’t slowed down.
Stale minified scripts and stylesheets remain until replaced by refreshed ones; this ensures that full-page caches which reference stale minified sources won’t result in any 404s.
Can serve compressed responses with gzip or deflate.
Transforms relatives paths in stylesheets (e.g. background-images) to absolute ones, so that they don’t 404.
Development of this plugin is done on GitHub. Pull requests welcome. Please see issues reported there before going to the plugin forum.
If you are using Nginx with the default Varying Vagrant Vagrants config, you’ll want to remove css|js from this rule in nginx-wp-common.conf (or remove the rule altogether):
# Handle all static assets by serving the file directly. Add directives
# to send expires headers and turn off 404 error logging.
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
}
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Dependency Minification」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 》WP-Optimize Cache 是一個革命性的、全方位的 WordPress 效能外掛,將您的網站做快取、清理資料庫及圖片壓縮,讓您的網站快速且最佳化。我們的快取功能是建構...。
SpeedyCache – Cache, Optimization, Performance 》SpeedyCache 是一款 WordPress 外掛,能透過網頁快取、最小化檔案和檔案壓縮的方式,幫助您減少網站載入時間。, 您可以在 https://speedycache.com/docs 找到...。
Clearfy Cache – WordPress optimization plugin, Minify HTML, CSS & JS, Defer 》數千個使用者已經使用 Clearfy 外掛優化他們的 WordPress 網站。這是一個綜合且免費的工具,擁有豐富的設定。搭配其他外掛使用,可以讓您的 WordPress 網站更...。
Minify HTML 》你可以在這個免費的測試網站試用這個外掛 => https://demo.tastewp.com/minify-html-markup, 有時候你可能會注意到自己網站的 HTML 標籤看起來較為混亂和...。
WP Super Minify • Minify, Compress and Cache HTML, CSS & JavaScript 》這個外掛可以在需要時結合、縮小和緩存內聯的 JavaScript 和 CSS 文件,以加快頁面加載速度,並使用Minify PHP Framework。, 啟用此外掛後,您會發現您的 HTM...。Better WordPress Minify 》允許您結合和縮小 CSS 和 JS 文件以提高頁面加載速度。 這個外掛使用 PHP 庫 Minify 並且依靠 WordPress 的編輯系統而不是輸出緩存,這樣就尊重 CSS 和 JS 文...。
Merge + Minify + Refresh 》這個外掛可以將層疊樣式表及 JavaScript 檔案合併/串連至群組中,接著使用 Minify(CSS)和 Google Closure(JS – 當 Minify 不可用時,使用回退至 Minify)...。
WP Minify Fix 》這個外掛是 WP Minify 的分支,旨在修復錯誤和添加功能,因為 WP Minify 自 2012 年 6 月 4 日以來就沒有進行更新了。, 這個外掛將Minify engine整合到您的 W...。
Powered Minifier 》Powered Minifier 可以讓你簡化你的 HTML、CSS 和 JS 代碼,以減少頁面載入時間,提高網站的效能。, 授權, 好消息,這個外掛是免費的!由於它使用 GPL 授權,...。MinQueue 》將 JS 和 CSS 文件進行最小化和合併可以減小資產文件的大小,減少 HTTP 請求的次數,有助於提高頁面加載速度。, 此外掛會使用手動定義的腳本/樣式手柄列表進...。
CSS Minify 》透過點擊一個按鈕,讓你的 CSS 最小化並優化。你只需要進入 WordPress 的設置,接著點擊 CSS Minify,啟用這個外掛即可自動將 CSS 最小化並優化,無需進行任...。
CSS Above The Fold 》透過在頁面上方(頁面頂部)使用網頁內的 CSS 優化使用者體驗。, 即使其餘的 CSS 也需要花費幾秒鐘的載入時間,但這些特定的 CSS 樣式會在頁首顯示,確保您的...。
WP Optimizer 》使用 WP-Optimizer(WPOPT)來提升您的 WordPress 效能和 SEO — 包含最常要求的維護 WordPress 功能。輕鬆自訂,透過逐步設置,增加網站速度,減少載入時間,...。
HTML Minify 》這是一個簡單和輕量級的外掛,可以讓您縮小網站的 HTML 輸出。, 文件, 如需更多信息和開發使用,請查看 benmarshall.me/html-minify。, 如果您對新附加功能有...。WP-Table Reloaded compatible for WP Minify 》使 WordPress 外掛「WP Table Reloaded」與「WP Minify」相容。。
