automattic / jetpack-lazy-images
此包已被废弃,不再维护。没有建议的替代包。
通过在访客滚动屏幕时加载图片,而不是一次性加载所有图片,可以加速您的网站并创建更流畅的浏览体验。现代浏览器现在支持懒加载,WordPress 本身也捆绑了用于图片和视频的懒加载功能。因此,此功能将随后被弃用
v3.0.1
2024-07-24 14:53 UTC
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-07-26 13:34:50 UTC
README
通过在访客滚动屏幕时加载图片,而不是一次性加载所有图片,可以加速您的网站并创建更流畅的浏览体验。
注意
此包已被废弃。WordPress 核心现在使用浏览器本地的懒加载,并且此处的代码与 Gutenberg 16.6 中添加的交互式 API 冲突。
使用方法
/* * 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' ) );
开发
运行测试需要正常工作的 svn
、composer
和 pnpm
命令。
安装这些之后,您可以通过运行以下命令安装 composer 依赖项
$ composer install --ignore-platform-reqs
生成压缩后的 JavaScript
可以从 Jetpack 仓库的根目录压缩 JavaScript 文件
$ cd ../../
$ pnpm build-packages
运行 PHP 单元测试
在本地开发环境中运行
$ composer phpunit
检查 PHP 源代码
可以从 Jetpack 仓库的根目录检查 PHP 代码
$ cd ../../
$ composer phpcs:compatibility packages/lazy-images
$ composer phpcs:lint packages/lazy-images
在您的 WordPress 插件中使用此包
如果您计划在您的 WordPress 插件中使用此包,我们建议您使用 Jetpack Autoloader 作为您的自动加载器。这将允许与其他使用此包的插件实现最大兼容性。
安全性
需要报告安全漏洞?请访问 https://automattic.com/security/ 或直接访问我们的安全漏洞赏金网站 https://hackerone.com/automattic。
许可证
jetpack-lazy-images 根据 GNU 通用公共许可证第2版(或更新版) 授权