PHPackages                             kunoichi/assets-lazy-loader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kunoichi/assets-lazy-loader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kunoichi/assets-lazy-loader
===========================

Lazy loader for WordPress theme.

1.2.0(2y ago)12491GPL-3.0-or-laterPHPPHP &gt;=7.4.0

Since Nov 30Pushed 2y agoCompare

[ Source](https://github.com/kuno1/assets-lazy-loader)[ Packagist](https://packagist.org/packages/kunoichi/assets-lazy-loader)[ RSS](/packages/kunoichi-assets-lazy-loader/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (5)Used By (0)

Assets Lazy Loader
==================

[](#assets-lazy-loader)

Lazy loader for WordPress theme.

Installation
------------

[](#installation)

Use composer.

```
composer require kunoichi/assets-lazy-loader

```

Usage
-----

[](#usage)

Enable each services 1 by 1 in your `functions.php`.

```
// in your functions.php
require __DIR__ . '/vendor/autoload.php';
```

### ImageLazyLoader

[](#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.

```
// Enable image lazy loader.
Kunoichi\AssetsLazyLoader\ImageLazyLoader::enable();
// If you want exclude some image(e.g. Featured image)
// a filter hook is available.
add_filter( 'assets_lazy_loader_image', function( $should, $tag ) {
	return false !== strpos( $tag,  'size-post-thumbnail' );
}, 10, 2 );
```

### Deferred Scripts

[](#deferred-scripts)

Add `defer` attributes to JavaScripts enqueued with `wp_enqueue_script`.

```
Kunoichi\AssetsLazyLoader\ScriptsDefer::enable( [
	'exclude'  => ['jquery-core'], // Only jQuery is not deferred.
	'in_login' => true, // Add defer on login screen. Default false.
	'in_admin' => true, // Same as above.
] );
```

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.

```
Kunoichi\AssetsLazyLoader\ScriptsDefer::enable( [
	// Defer scripts only which you know they are safe with defer attribute.
	'exclude'  => [ 'your-js', 'jquery' ],
] );
```

### CSS Preload

[](#css-preload)

Add `rel="preload"` to `link` tag and fallback scripts.

```
Kunoichi\AssetsLazyLoader\StyleLoader::enable( [
	'exclude'  => StyleLoader::admin_critical( ['twentytwenty-style'] ), // Exclude default style and login/admin screen.
	'in_login' => true,
	'in_admin' => true,
] )
```

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

[](#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`.

```
JqueryOptimizer::enable( [
	'footer'  => true, // Move jQuery to footer.
	'src'     => 'https://code.jquery.com/jquery-3.5.1.slim.js', // Slim version from https://code.jquery.com/
	'version' => '3.5.1', // Specify collect version.
] );
```

Ackowledgements
---------------

[](#ackowledgements)

- CSS preload depends on [fg-loadcss v2.1.0](https://www.npmjs.com/package/fg-loadcss/v/2.1.0) by Filament Group.

License
-------

[](#license)

GPL 3.0 or later.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~394 days

Total

4

Last Release

858d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/84587?v=4)[Takahashi Fumiki](/maintainers/fumikito)[@fumikito](https://github.com/fumikito)

---

Top Contributors

[![fumikito](https://avatars.githubusercontent.com/u/84587?v=4)](https://github.com/fumikito "fumikito (11 commits)")

### Embed Badge

![Health badge](/badges/kunoichi-assets-lazy-loader/health.svg)

```
[![Health](https://phpackages.com/badges/kunoichi-assets-lazy-loader/health.svg)](https://phpackages.com/packages/kunoichi-assets-lazy-loader)
```

###  Alternatives

[typo3/cms-recordlist

TYPO3 CMS Recordlist - Lists database records in the TYPO3 backend module (Web&gt;List).

178.1M52](/packages/typo3-cms-recordlist)[tzookb/tbmsg

users messaging system

10917.1k](/packages/tzookb-tbmsg)[andrewcarteruk/cryptokey

A command line tool for generating keys using a CSPRNG.

6024.3k](/packages/andrewcarteruk-cryptokey)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
