Leírás
This plugin is no longer recommended. Deferring every stylesheet makes the page paint before its own layout arrives. That flash of unstyled content is measured as Cumulative Layout Shift — one of the Core Web Vitals this plugin is meant to improve.
The current advice is to inline the CSS needed for the top of the page and defer only the rest, which is more than rewriting a link tag can do.
If you have not configured the exclusion filter for your main stylesheets, deactivating this plugin will most likely improve your scores rather than worsen them.
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.
Telepítés
- Upload the complete
speed-up-optimize-css-deliveryfolder to the/wp-content/plugins/directory - Activate the plugin through the ‘Plugins’ menu in WordPress
Vélemények
Közreműködők és fejlesztők
“Speed Up – Optimize CSS Delivery” egy nyílt forráskódú szoftver. A bővítményhez a következő személyek járultak hozzá:
Közreműködők“Speed Up – Optimize CSS Delivery” fordítása a saját nyelvünkre.
Érdekeltek vagyunk a fejlesztésben?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Változási napló
1.0.14
- Deprecated: deferring every stylesheet causes a flash of unstyled content, measured as Cumulative Layout Shift. A dashboard notice explains the trade-off and when deactivating will improve your scores
1.0.13
- Fix the media attribute being captured too greedily: an attribute added after it by another filter ended up inside the generated tag
- Escape the stylesheet handle and URL before writing them into the tag
- Declare minimum requirements: WordPress 6.0 and PHP 7.0
1.0.12
- Tested up to WordPress 7.0
1.0.11
- Tested up to WordPress 6.0
1.0.10
- Tested up to WordPress 5.9
1.0.9
- Tested up to WordPress 5.7
1.0.8
- Tested up to WordPress 5.5
1.0.7
- Tested up to WordPress 5.5
1.0.6
- Tested up to WordPress 5.3
1.0.5
- Tested up to WordPress 5.2
1.0.4
- Fix some css are loaded two time
1.0.3
- Update loadCSS
1.0.2
- Tested up to WordPress 4.9
- Update loadCSS
1.0.1
- Fix bug css not loaded if cached.
1.0.0
- Initial release.
