
內容簡介
這個小外掛(5 Kb)可以異步載入樣式表並提高頁面載入速度。
建議使用此外掛程式來同步載入重要的樣式表和異步載入非關鍵的 CSS 檔案。
非關鍵的 CSS 檔案可以包括:字型、圖示、網頁折疊前的特定模板 CSS 等等。
你可以選擇在 function.php 中使用篩選器同步載入哪些檔案,例如:
// 排除主要和子樣式表不受優化
function exclude_from_delivery_optimization($handle){
return in_array($handle, array('main-stylesheet', 'child-stylesheet'));
}
add_filter('speed-up-optimize-css-delivery', 'exclude_from_delivery_optimization');
注意:這僅在其他外掛和佈景主題正確添加 CSS 的情況下才可運作。
外掛標籤
開發者團隊
② 後台搜尋「Speed Up – Optimize CSS Delivery」→ 直接安裝(推薦)
原文外掛簡介
This small plugin (5 Kb) loads the stylesheets asynchronously and improve page load times.
The recommended use of this plugin is to load your vital stylesheets synchronously and non-vital CSS files asynchronously.
Non-vital CSS-files can be for example: fonts, icons, before the fold template-specific CSS, etc.
You can choose which files to load synchronously with a filter in your function.php, eg.:
// exclude main and child stylesheets from delivery optimization
function exclude_from_delivery_optimization($handle){
return in_array($handle, array('main-stylesheet', 'child-stylesheet'));
}
add_filter('speed-up-optimize-css-delivery', 'exclude_from_delivery_optimization');
Note: this only works if your other plugins and theme add the CSS correctly.
