Git Product home page Git Product logo

automattic / jetpack-lazy-images Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 3.0 315 KB

[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: Other

JavaScript 28.40% PHP 71.60%
jetpack

jetpack-lazy-images's Introduction

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

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)

jetpack-lazy-images's People

Contributors

adimoldovan avatar anomiex avatar bindlegirl avatar brbrr avatar coder-karen avatar davidlonjon avatar dhasilva avatar glendaviesnz avatar gogdzl avatar gravityrail avatar guarani avatar haqadn avatar ice9js avatar jeherve avatar kallehauge avatar kbrown9 avatar kraftbj avatar lhkowalski avatar markbiek avatar nateweller avatar nunyvega avatar ouikhuan avatar paulopmt1 avatar pgk avatar psealock avatar samiff avatar sdixon194 avatar simison avatar thingalon avatar zinigor avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.