Download the PHP package kunoichi/assets-lazy-loader without Composer
On this page you can find all versions of the php package kunoichi/assets-lazy-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kunoichi/assets-lazy-loader
More information about kunoichi/assets-lazy-loader
Files in kunoichi/assets-lazy-loader
Package assets-lazy-loader
Short Description Lazy loader for WordPress theme.
License GPL-3.0-or-later
Informations about the package assets-lazy-loader
Assets Lazy Loader
Lazy loader for WordPress theme.
Installation
Use composer.
Usage
Enable each services 1 by 1 in your functions.php
.
ImageLazyLoader
Filter all img
tag in your HTML and add loading="lazy"
attributes. If the img
tag already has loading
attribute, no more attribute will be added.
Deferred Scripts
Add defer
attributes to JavaScripts enqueued with wp_enqueue_script
.
Some JavaScripts have following scripts via wp_add_inline_script
. This may cause critical erros. ScriptDefer
skips enqueued scripts with after
section, but for more safety, consider allow list approach.
CSS Preload
Add rel="preload"
to link
tag and fallback scripts.
CSS preload caused non styled html in few seconds. To avoid shrinking of the screen by re-rendering, exclude critical css files from preload. In many case, it's the theme's main styelsheed.
StyleLoader::admin_critical
is helpful for excluding ciritcal css in admin and login screen.
jQuery Enhancement
The default jQuery bundled with WordPress has some issued.
- Version is old(1.12.4).
- Shipped with jQuery migrate unnecessory for sane plugins and themes.
- Enqueued in
head
tag.
You can assign other version of jQuery and drop jquery-migrate
.
Ackowledgements
- CSS preload depends on fg-loadcss v2.1.0 by Filament Group.
License
GPL 3.0 or later.