From 735333ad949b0fd7e76a6e7786a4fab754bfb295 Mon Sep 17 00:00:00 2001 From: Quazz Date: Wed, 30 Mar 2022 15:36:19 +0200 Subject: [PATCH 1/2] Don't preload lazy loading images Prevent loading="lazy" images from being added to preload --- Link/LinkParser.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Link/LinkParser.php b/Link/LinkParser.php index 8e47372..c3ac26a 100644 --- a/Link/LinkParser.php +++ b/Link/LinkParser.php @@ -179,7 +179,10 @@ private function addScriptsAsLinkHeader(Crawler $crawler) private function addImagesAsLinkHeader(Crawler $crawler) { $crawler->each(function (Crawler $crawler) { - $this->addLink($crawler->extract(['src'])[0], 'image', $crawler->outerHtml()); + $loadType = $crawler->extract(['loading']); + if (empty($loadType) || $loadType[0] !== "lazy") { + $this->addLink($crawler->extract(['src'])[0], 'image', $crawler->outerHtml()); + } }); } From a05f4bb86157119929e0ed08c34716fc973366a9 Mon Sep 17 00:00:00 2001 From: jisse Reitsma Date: Thu, 31 Mar 2022 11:48:34 +0200 Subject: [PATCH 2/2] Release --- CHANGELOG.md | 4 ++++ composer.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd25957..7bc975a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.4.15] - 31 March 2022 +### Fixed +- Don't preload lazy loading images #36 (@Quazz) + ## [1.4.14] - 20 February 2022 ### Fixed - Missing crossorigin in html output (@mageho) diff --git a/composer.json b/composer.json index 3040af5..24a8244 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "yireo/magento2-linkpreload", - "version": "1.4.14", + "version": "1.4.15", "license": "OSL-3.0", "type": "magento2-module", "homepage": "https://www.yireo.com/software/magento-extensions/linkpreload",