前言介紹
- 這款 WordPress 外掛「Merge + Minify + Refresh」是 2015-04-14 上架。
- 目前有 5000 個安裝啟用數。
- 上一次更新是 2024-07-29,距離現在已有 277 天。
- 外掛最低要求 WordPress 6.4.0 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
- 有 68 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
merge | minify | closure | refresh | concatenate |
內容簡介
這個外掛可以將層疊樣式表及 JavaScript 檔案合併/串連至群組中,接著使用 Minify(CSS)和 Google Closure(JS – 當 Minify 不可用時,使用回退至 Minify)進行減量。減量是透過 WP-Cron 進行,以確保不會減緩網站速度。當 JS 或 CSS 被更改時,會重新處理檔案。不需要清空快取!
本外掛靈感來自於 MinQueue 和 Dependency Minification 外掛。
減量功能由 Minify 和 Google Closure 提供。
為確保快速的載入速度,建議應將 CSS 和 JS 設定長時間的到期日期,以及確保啟用 gzip 或 deflate。
1.10 版新增 should_mmr 過濾器,允許開發人員在需要時禁用 MMR。你可以使用此功能來禁用某些 WordPress 角色或某些頁面生成器的 MMR。創建了三個新的外掛程式,它們利用了這一點:Merge + Minify + Refresh Check DIVI、Merge + Minify + Refresh Check Visual Composer 和 Merge + Minify + Refresh Check Beaver Builder。請在需要時安裝這些程式。
1.6 版增加了對 HTTP2 模擬推送的支援以進一步加快您的請求速度(感謝 Daniel Aleksandersen)。
1.6.9 版新增了指定快取目錄的功能。在 wp-config.php 中設定 MMR_CACHE_DIR 和 MMR_CACHE_URL 常數。MMR_CACHE_DIR 必須是完整的服務器路徑,而 MMR_CACHE_URL 必須是絕對 URL,以使其正確運作(感謝 Daniel Aleksandersen)。
1.6.11 版增加了為 JavaScript 和 CSS 指定獨立的快取 URL 的功能。使用 MMR_JS_CACHE_URL 和 MMR_CSS_CACHE_URL 以替換 MMR_CACHE_URL。
1.7.0 版新增了生成 .css.gz 與 .js.gz 檔案的功能。你的網頁伺服器可能需要配置以使用這些檔案。以下是在 Apache 中使用這些檔案的方法:
" #Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
#Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
#Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=is_gzip:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=is_gzip:1]
Header set Content-Encoding "gzip" env=is_gzip
"
1.8.8 版新增一個 merge_minify_refresh_done 鉤子,當 JS 或 CSS 發生變化時會觸發此鉤子。
1.11 版新增兩個新常數:
MMR_USE_CLOSURE – 允許禁用 Google Closure JavaScript 減量。
MMR_REMOVE_EXPIRED – 禁用過期文件的刪除。
1.13 版新增兩個可用於排除特定檔案的篩選器:mmr_ignored_css_sources、mmr_ignored_js_sources。1.13 版還將 WordPress 的內含樣式自動移至全局樣式表並排入程式行列。
備註:在安裝此外掛程式時,可能需要先停用 eAccellera 函式庫。
原文外掛簡介
This plugin merges/concatenates Cascading Style Sheets & Javascript files into groups. It then minifies the generated files using Minify (for CSS) and Google Closure (for JS – fallback to Minify when not available). Minification is done via WP-Cron so that it doesn’t slow down the website. When JS or CSS changes files are re-processed. No need to empty cache!
Inspired by MinQueue and Dependency Minification plugins.
Minification by Minify and Google Closure
In order to ensure fast loading times it’s recommended to set long expiry dates for CSS and JS as well as make sure gzip or deflate is on.
Version 1.10 added should_mmr filter which allows developers to disable MMR when needed. You could use this to disable MMR for certain WordPress roles or with some Page Builders. Three new plugins have been created that utilise this:
Merge + Minify + Refresh Check DIVI, Merge + Minify + Refresh Check Visual Composer and Merge + Minify + Refresh Check Beaver Builder. Please install these when required.
Version 1.6 added support for HTTP2 Server Push to further speed up your requests (thanks to Daniel Aleksandersen).
Version 1.6.9 added the ability to specify the cache directory. Set MMR_CACHE_DIR & MMR_CACHE_URL constants in wp-config.php. MMR_CACHE_DIR must be full server path and MMR_CACHE_URL must be absolute URL for this to work correctly (thanks to Daniel Aleksandersen).
Version 1.6.11 added the ability to specify seperate cache urls for javascript and CSS. Use MMR_JS_CACHE_URL & MMR_CSS_CACHE_URL to replace MMR_CACHE_URL.
Version 1.7.0 added the ability to generate .css.gz & .js.gz files. Your webserver may need to be configured to use these files. Here is how to use these files in Apache (mod_rewrite, mod_deflate and mod_headers need to be enabled):
#Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
#Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
#Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=is_gzip:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=is_gzip:1]
Header set Content-Encoding "gzip" env=is_gzip
Version 1.8.8 added a “merge_minify_refresh_done” hook that fires when JS or CSS has changed.
Version 1.11 added two new constants:
MMR_USE_CLOSURE – allows Google Closure Javascript minification to be disabled.
MMR_REMOVE_EXPIRED – disables removing expired files.
Version 1.13 added two new filters which can be used to exclude specific files:
mmr_ignored_css_sources
mmr_ingnored_js_sources
Version 1.13 also automatically moves the WordPress inline styles to a global stylesheet which it then enqueues.
Version 1.14.3 added two new filters which can be used to modify the output before it gets saved:
modify_css_output_before_save
modify_js_output_before_save
Note Installing this plugin on a server with the eAccellerator module installed has the potential to break as Minify uses anonymous functions which return NULL. View eAccellerator Issue Thread
Features
Merges JS and CSS files to reduce the number of HTTP requests
Handles scripts loaded in the header & footer
Compatible with localised scripts
Creates WP-Cron for minification as this can take some time to complete
Minifies JS with Google Closure (requires php exec) with fallback to Minify
Minifies CSS with Minify
Failed minification doesn’t break the site. Visitors will instead only see the merged results
Stores Assets in /wp-content/mmr/ folder
Uses last modified date in filename so any changes to JS or CSS automatically get re-processed and downloaded on browser refresh
View status of merge and minify on settings page in WordPress admin
Option to enable http2 server push (thanks to Daniel Aleksandersen)
Option to enable output buffering for compatibility and so footer scripts can be HTTP2 pushed
Ability to turn off minification
Ability to turn off concatenation
Ability to manually ignore scripts or css
Ignores conditional scripts and styles
Ability to specify cache directories
Ability to generate .css.gz & .js.gz files (Thanks to Marcus Svensson)
Works with WordPress Multisite
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Merge + Minify + Refresh」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.8 | 1.9 | 1.10 | 1.11 | 1.12 | 1.6.6 | 1.6.7 | 1.6.8 | 1.7.5 | 1.8.1 | 1.8.2 | 1.8.3 | 1.8.4 | 1.8.5 | 1.8.6 | 1.8.7 | 1.8.8 | 1.8.9 | 1.10.1 | 1.10.2 | 1.10.3 | 1.10.4 | 1.10.5 | 1.10.6 | 1.10.7 | 1.10.8 | 1.10.9 | 1.6.12 | 1.8.10 | 1.8.11 | 1.8.12 | 1.10.10 | 1.10.11 |
延伸相關外掛(你可能也想知道)
Merge + Minify + Refresh Check DIVI 》這個外掛可以讓 DIVI 編輯器與 Merge + Minify + Refresh 外掛相容。。
Merge + Minify + Refresh Check Visual Composer 》這個外掛可以讓 Visual Composer 編輯器與 Merge + Minify + Refresh 外掛一起使用。Merge + Minify + Refresh 是一個 WordPress 外掛。。
Merge + Minify + Refresh Check Beaver Builder 》此外掛讓 Beaver Builder 編輯器與 Merge + Minify + Refresh 一起運作。。