Skip to content

[READ ONLY] Speed up your site and create a smoother viewing experience by loading images as visitors scroll down the screen, instead of all at once. This repository is a mirror, for issue tracking and development head to: https://github.com/automattic/jetpack

License

Automattic/jetpack-lazy-images

v2.0.9
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

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.

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

About

[READ ONLY] Speed up your site and create a smoother viewing experience by loading images as visitors scroll down the screen, instead of all at once. This repository is a mirror, for issue tracking and development head to: https://github.com/automattic/jetpack

Topics

Resources

License

Security policy

Stars

Watchers

Forks