automattic / jetpack-lazy-images
Speed up your site and create a smoother viewing experience by loading images as visitors scroll down the screen, instead of all at once. Modern browsers now support lazy loading, and WordPress itself bundles lazy loading features for images and videos. This feature will consequently be deprecated i
Installs: 28 131
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 3
Type:jetpack-library
Requires
- php: >=7.0
- automattic/jetpack-assets: ^2.2.0
- automattic/jetpack-constants: ^2.0.3
- automattic/jetpack-status: ^3.3.2
Requires (Dev)
- automattic/jetpack-changelogger: ^4.2.5
- automattic/wordbless: dev-master
- yoast/phpunit-polyfills: 1.1.0
Suggests
- automattic/jetpack-autoloader: Allow for better interoperability with other plugins that use this package.
- dev-trunk / 3.0.x-dev
- v3.0.1
- v3.0.0
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.45
- v2.1.44
- v2.1.43
- v2.1.42
- v2.1.41
- v2.1.40
- v2.1.39
- v2.1.38
- v2.1.37
- v2.1.36
- v2.1.35
- v2.1.34
- v2.1.33
- v2.1.32.1
- v2.1.32
- v2.1.31
- v2.1.30
- v2.1.29
- v2.1.28
- v2.1.27
- v2.1.26
- v2.1.25
- v2.1.24
- v2.1.23
- v2.1.22
- v2.1.21
- v2.1.20
- v2.1.19
- v2.1.18
- v2.1.17
- v2.1.16
- v2.1.15
- v2.1.14
- v2.1.13
- v2.1.12
- v2.1.11
- v2.1.10
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.10
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.5.1
- v1.5.0
- v1.4.4
- v1.4.3
- 1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.0
- dev-prerelease
- dev-release-v2.1.32.1
- dev-fix/slack-workflow-branch-detection
- dev-fix/release-branch-typo
- dev-update/generate-branch-plugin
- dev-release-v1.4.1
- dev-release-v1.4.0
- dev-feature/reorg
- dev-release-v1.3.0
- dev-release-v1.2.2
- dev-release-v1.1.3
- dev-release-v1.1.2
- dev-release-v1.2.1
- dev-release-v1.1.1
- dev-release-v1.2.0
- dev-release-v1.1.0
- dev-release-v1.0.0
This package is auto-updated.
Last update: 2024-12-04 22:39:38 UTC
README
Speed up your site and create a smoother viewing experience by loading images as visitors scroll down the screen, instead of all at once.
Caution
This package is abandoned. WordPress Core now uses browsers' native lazy loading, and the code in here conflicts with the Interactivity API added in Gutenberg 16.6.
Usage
/* * Initialize lazy images on the wp action so that conditional * tags are safe to use. * * As an example, this is important if a theme wants to disable lazy images except * on single posts, pages, or attachments by short-circuiting lazy images when * is_singular() returns false. * * See: https://github.com/Automattic/jetpack/issues/8888 */ add_action( 'wp', array( 'Automattic\\Jetpack\\Jetpack_Lazy_Images', 'instance' ) );
Development
Running tests requires working svn
, composer
and pnpm
commands.
Once these are installed, you install the composer dependencies by running:
$ composer install --ignore-platform-reqs
Generate minified JavaScript
The JavaScript file can be minified from the root of the Jetpack repository:
$ cd ../../
$ pnpm build-packages
Run PHP unit tests
On a local development environment run:
$ composer phpunit
Lint PHP source code
The PHP code can be linted from the root of the Jetpack repository:
$ cd ../../
$ composer phpcs:compatibility packages/lazy-images
$ composer phpcs:lint packages/lazy-images
Using this package in your WordPress plugin
If you plan on using this package in your WordPress plugin, we would recommend that you use Jetpack Autoloader as your autoloader. This will allow for maximum interoperability with other plugins that use this package as well.
Security
Need to report a security vulnerability? Go to https://automattic.com/security/ or directly to our security bug bounty site https://hackerone.com/automattic.
License
jetpack-lazy-images is licensed under GNU General Public License v2 (or later)