[WordPress] 外掛分享: W3TC Minify Helper

前言介紹

  • 這款 WordPress 外掛「W3TC Minify Helper」是 2019-02-13 上架。
  • 目前尚無安裝啟用數,是個很新的外掛。如有要安裝使用,建議多測試確保功能沒問題!
  • 上一次更新是 2019-02-14,距離現在已有 2270 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 5.0 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 7.0 以上。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

magenta-cuda |

外掛標籤

W3TC | minify | javascript |

內容簡介

這是一個 W3 Total Cache 外掛的輔助工具,它會產生一個 W3TC JSON 配置檔,可用於匯入至 W3TC 中。

W3TC 的自動縮小模式在我的網站上無法正常運作。問題在於使用自動縮小模式的 JavaScript 檔案順序與未縮小的順序不同。這導致 JavaScript 函數錯誤未定義。W3TC 提供了手動設置 JavaScript 檔案順序的幫助工具,但我認為這個工具很麻煩。我只想要和未縮小的檔案順序相同。因此,我撰寫了這個外掛程式。

此外掛需要了解您的網站使用的 JavaScript 檔。每個網頁視圖都會為該網頁的範本設置有序的 JavaScript 檔案清單。如果這個有序清單已更改,則會通過修改當前 W3TC 配置的「minify.js.groups」字段的值,以與該清單相容,生成一個新的 W3TC 配置檔。這個過程是累積的,因此在為每個範本查看代表性網頁後,將生成完整的 W3TC 配置檔。此外,如果稍後模板的有序 JavaScript 檔案列表更改,則這也會產生一個新的相容的 W3TC 配置檔。

註:W3TC 假設模板的有序 JavaScript 檔案清單是固定的。如果您的網頁動態計算 JavaScript 檔案,並且使用相同模板的兩個不同網頁計算不同的 JavaScript 檔案清單,則 W3TC 無法用於縮小這些 JavaScript 檔案。此外,手動縮小模式的 W3TC 只能看到活動佈景主題目錄中的範本檔案。但是,使用「template_include」過濾器,外掛可以強制 WordPress 載入外掛目錄中的範本,而不是佈景主題目錄中的範本。手動縮小模式的 W3TC 不能用於縮小放在外掛目錄中的範本的 JavaScript 檔案。

此外掛生成的新 JSON 配置檔可以下載,進一步編輯以微調縮小過程,並重新匯入至 W3TC。下載連結位於「已安裝的外掛」管理頁面,在「停用」連結後。但是,在匯入此新配置檔至 W3TC 之前,應該下載目前的 W3TC 配置,以便在新配置失效時恢復當前配置。此外,在將新配置檔匯入至 W3TC 之前,應該對比新配置檔和當前配置檔,以驗證新配置檔是否有明顯的錯誤。並檢查「minify.js.groups」部分,以確認每個範本都有一個條目,以驗證配置是否完整。

註:如果要使用此外掛程式生成的有序 JavaScript 檔案清單,W3TC 的「縮小模式」必須設置為「手動」。

原文外掛簡介

This is a helper plugin for the W3 Total Cache plugin. It generates a W3TC JSON configuration file that can be imported into W3TC.
The W3TC auto minify mode does not work on my web site. The problem is the order of the JavaScript files using the auto minify mode is different from the order without minification. This results in undefined JavaScript function errors. W3TC has a help tool for manually setting the order of JavaScript files. I think this tool is tiresome to use. I just want to have the same order as without minification. So, I wrote this plugin to do this.
This plugin needs to learn about the JavaScript files that your website uses. Every view of a web page sets the ordered list of JavaScript files for the template of that web page. If this ordered list has changed a new W3TC configuration file is generated by modifying the value of the field ‘minify.js.groups’ of the current W3TC configuration to be compatible with the new ordered list of JavaScript files for that template. This process is cumulative so after viewing a representative web page for each template a complete W3TC configuration file will be generated. Further, if some time later the ordered list of JavaScript files for a template changes then this will also generate a new compatible W3TC configuration file.
N.B. – W3TC assumes that the ordered list of JavaScript files for a template is fixed. If your web pages are dynamically computing the JavaScript files and two different web pages using the same template compute different lists of JavaScript files then W3TC cannot be used to minify those JavaScript files. Also, W3TC in manual minify mode only sees the template files in the active theme directory. However, using the ‘template_include’ filter a plugin can force WordPress to load a template in the plugin’s directory instead of a template in the theme’s directory. W3TC in manual minify mode cannot be used minify the JavaScript files of templates in plugin directories.
The new JSON configuration file generated by this plugin can be downloaded, further edited to fine tune the minify process and imported back into W3TC. The download link is on the “Installed Plugins” admin page after the “Deactivate” link. But, before you import this new configuration file into W3TC, you should download the current configuration of W3TC so that you can restore the current configuration if the new configuration does not work. Also, before importing the new configuration file into W3TC you should diff the new configuration file against the current configuration file to verify that the new configuration file has no obvious errors. You should also verify that you have a complete configuration by viewing the ‘minify.js.groups’ section and checking that there is an entry for each of your templates.
N.B. – W3TC “Minify mode” must be set to “Manual” for W3TC to use the ordered list of JavaScript files generated by this
plugin.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「W3TC Minify Helper」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0 | trunk | 1.0.0.1 |

延伸相關外掛(你可能也想知道)

  • 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 網站更...。
  • WP Super Minify • Minify, Compress and Cache HTML, CSS & JavaScript 》這個外掛可以在需要時結合、縮小和緩存內聯的 JavaScript 和 CSS 文件,以加快頁面加載速度,並使用Minify PHP Framework。, 啟用此外掛後,您會發現您的 HTM...。
  • Minify HTML 》你可以在這個免費的測試網站試用這個外掛 => https://demo.tastewp.com/minify-html-markup, 有時候你可能會注意到自己網站的 HTML 標籤看起來較為混亂和...。
  • Better WordPress Minify 》允許您結合和縮小 CSS 和 JS 文件以提高頁面加載速度。 這個外掛使用 PHP 庫 Minify 並且依靠 WordPress 的編輯系統而不是輸出緩存,這樣就尊重 CSS 和 JS 文...。
  • Merge + Minify + Refresh 》這個外掛可以將層疊樣式表及 JavaScript 檔案合併/串連至群組中,接著使用 Minify(CSS)和 Google Closure(JS – 當 Minify 不可用時,使用回退至 Minify)...。
  • WP Speed Optimization By Add Expires Headers & Optimized Minify Plugin 》這款外掛能夠通過在使用者瀏覽器中緩存不同類型的靜態文件來提升您的網站加載速度,同時還提供資源壓縮功能,減小頁面的資料大小並減少 HTTP 請求的數量,因...。
  • 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 功能。輕鬆自訂,透過逐步設置,增加網站速度,減少載入時間,...。
  • Optimize Scripts & Styles 》Optimize Scripts & Styles是一個WordPress外掛程式,它在結合、減小檔案體積和快取javascript和css檔案時優化您的網站。這將有助於減少提供的檔案數量及...。

文章
Filter
Apply Filters
Mastodon