automattic/jetpack-lazy-images
最新稳定版本:v3.0.1
Composer 安装命令:
composer require 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
README 文档
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)
automattic/jetpack-lazy-images 适用场景与选型建议
automattic/jetpack-lazy-images 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29.3k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2020 年 08 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 automattic/jetpack-lazy-images 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 automattic/jetpack-lazy-images 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 29.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2020-08-10