diff --git a/package-lock.json b/package-lock.json index b5b06e08ef..50d45d854d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11928,11 +11928,6 @@ "package-json": "^6.3.0" } }, - "lazysizes": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/lazysizes/-/lazysizes-5.2.2.tgz", - "integrity": "sha512-fYgOv1Y35M86/7qyAdPPqoOhuyZrjxEAPxqwToRY2bO/PoBJ4lSqZYuZoavNp6eyuLpIAdHodpsPfj2Lkt86FQ==" - }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", diff --git a/package.json b/package.json index 7335981432..fa3097817b 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "foundation-sites": "^5.5.3", "jquery": "^3.5.1", "jstree": "^3.3.12", - "lazysizes": "5.2.2", "lodash": "^4.17.21", "nanobar": "^0.4.2", "nod-validate": "^2.0.12", diff --git a/templates/components/account/order-contents.html b/templates/components/account/order-contents.html index f2b452365f..7e8e7ff592 100644 --- a/templates/components/account/order-contents.html +++ b/templates/components/account/order-contents.html @@ -33,6 +33,7 @@
{{lang 'account.orders.details.ship_to_mu fallback_size=../theme_settings.productthumb_size lazyload=../theme_settings.lazyload_mode default_image=../theme_settings.default_image_product + sizes=(concat (first (split ../theme_settings.productthumb_size 'x')) 'px') }} {{/if}} {{#unless refunded}} diff --git a/templates/components/account/orders-list.html b/templates/components/account/orders-list.html index 71193a0c65..371f000c76 100644 --- a/templates/components/account/orders-list.html +++ b/templates/components/account/orders-list.html @@ -17,6 +17,7 @@

{{lang 'account.orders.heading' }}

fallback_size=../theme_settings.productthumb_size lazyload=../theme_settings.lazyload_mode default_image=../theme_settings.default_image_product + sizes=(concat (first (split ../theme_settings.productthumb_size 'x')) 'px') }} {{/if}} diff --git a/templates/components/account/returns-list.html b/templates/components/account/returns-list.html index 145d1cd952..e185921557 100644 --- a/templates/components/account/returns-list.html +++ b/templates/components/account/returns-list.html @@ -9,6 +9,7 @@

{{lang 'account.returns.heading' }}

image=product.image fallback_size=../theme_settings.productthumb_size lazyload=../theme_settings.lazyload_mode + sizes=(concat (first (split ../theme_settings.productthumb_size 'x')) 'px') }}
diff --git a/templates/components/blog/post.html b/templates/components/blog/post.html index 885e5925a5..e59fba4d66 100644 --- a/templates/components/blog/post.html +++ b/templates/components/blog/post.html @@ -7,6 +7,7 @@ image=post.thumbnail fallback_size=theme_settings.blog_size lazyload=theme_settings.lazyload_mode + sizes=(concat (first (split theme_settings.blog_size 'x')) 'px') }} diff --git a/templates/components/carousel.html b/templates/components/carousel.html index a34da1a0d3..62562d23a4 100644 --- a/templates/components/carousel.html +++ b/templates/components/carousel.html @@ -27,6 +27,7 @@ class="heroCarousel-image" fallback_size='1280w' lazyload='disabled' + sizes='(max-width: 640px) 640px, (max-width: 1280px) 1280px, (max-width: 1920px) 1920px, 2560px' }} {{else}} {{> components/common/responsive-img @@ -34,6 +35,7 @@ class="heroCarousel-image" fallback_size='1280w' lazyload='lazyload' + sizes='(max-width: 640px) 640px, (max-width: 1280px) 1280px, (max-width: 1920px) 1920px, 2560px' }} {{/if}} {{#if button_text}} diff --git a/templates/components/cart/content.html b/templates/components/cart/content.html index 772f3f3012..c05591c2e1 100644 --- a/templates/components/cart/content.html +++ b/templates/components/cart/content.html @@ -25,6 +25,7 @@ fallback_size=../theme_settings.productthumb_size lazyload="lazyload" default_image=../theme_settings.default_image_product + sizes='80px' }} {{/if}} diff --git a/templates/components/cart/preview.html b/templates/components/cart/preview.html index 82430c6435..c0b4874b44 100644 --- a/templates/components/cart/preview.html +++ b/templates/components/cart/preview.html @@ -61,6 +61,7 @@

fallback_size=../theme_settings.product_size lazyload=../theme_settings.lazyload_mode default_image=../theme_settings.default_image_product + sizes='(min-width: 800px) 80px, 640px' }}

diff --git a/templates/components/common/cart-preview.html b/templates/components/common/cart-preview.html index 3d416e3a64..9d84a97206 100644 --- a/templates/components/common/cart-preview.html +++ b/templates/components/common/cart-preview.html @@ -17,6 +17,7 @@ fallback_size=../theme_settings.productthumb_size lazyload=../theme_settings.lazyload_mode default_image=../theme_settings.default_image_product + sizes="160px" }} {{/if}} diff --git a/templates/components/common/responsive-img.html b/templates/components/common/responsive-img.html index eb6f40289f..7da11a504f 100644 --- a/templates/components/common/responsive-img.html +++ b/templates/components/common/responsive-img.html @@ -1,16 +1,7 @@ {{!-- -This file implements the lazysizes srcset pattern (as seen on -https://github.com/aFarkas/lazysizes#modern-transparent-srcset-pattern) for maximum performance on modern browsers -and reasonable compatibility with legacy browsers. - There are a few important arguments to know about when using this component: `lazyload`: - - If set to 'lazyload+lqip', will load a low-res image which will be replaced by lazysizes - ensuring that SOME - content is shown immediately on page load. Without LQIP, a transparent gif will be used instead, which reduces - the number of requests needed to load the page, making it even faster. - - If set to 'lazyload', the browser will not load the full-size image at first, instead the lazysizes plugin will - load it progressively after page load. This improves the load speed of the page, but it should be disabled for - high-priority above-the-fold images. + - If set to 'lazyload', the browser will make a decision about when to load the image based on whether its proximity to the viewport. - If set to 'disabled', will not attempt to lazyload the image and instead tell the browser to load it immediately. Use this for high-priority images that are above the fold. @@ -30,32 +21,17 @@ path in the theme config. If a default image is not provided, you'll get an image tag with no image if the primary image is undefined. -`lqip_size`: - If you want to specify a particular size for the LQIP image, you can do so with this argument. A default of 80 - pixels wide will be used otherwise. This argument has no effect if the lazyload mode is not "lazyload+lqip". - ---}} -{{image.alt}} diff --git a/templates/components/products/card.html b/templates/components/products/card.html index ffb35527cc..e64469b40f 100644 --- a/templates/components/products/card.html +++ b/templates/components/products/card.html @@ -72,6 +72,7 @@ fallback_size=theme_settings.productgallery_size lazyload=theme_settings.lazyload_mode default_image=theme_settings.default_image_product + sizes='320px' }} diff --git a/templates/components/products/list-item.html b/templates/components/products/list-item.html index 7a62bdbc09..3f6df39c47 100644 --- a/templates/components/products/list-item.html +++ b/templates/components/products/list-item.html @@ -57,6 +57,7 @@ fallback_size=theme_settings.productgallery_size lazyload=theme_settings.lazyload_mode default_image=theme_settings.default_image_product + sizes='320px' }} {{#unless hide_product_quick_view}} diff --git a/templates/components/products/modals/writeReview.html b/templates/components/products/modals/writeReview.html index 8f428d662c..e1115ace70 100644 --- a/templates/components/products/modals/writeReview.html +++ b/templates/components/products/modals/writeReview.html @@ -15,6 +15,7 @@ fallback_size=theme_settings.product_size lazyload=theme_settings.lazyload_mode default_image=theme_settings.default_image_product + sizes=(concat (first (split theme_settings.product_size 'x')) 'px') }}
{{ product.brand.name }}
diff --git a/templates/components/products/options/product-list.html b/templates/components/products/options/product-list.html index e963b325ba..8349e74bf2 100644 --- a/templates/components/products/options/product-list.html +++ b/templates/components/products/options/product-list.html @@ -26,7 +26,8 @@ {{> components/common/responsive-img image=image class="productOptions-list-item-image" - lazyload='lazyload+lqip' + lazyload='lazyload' + sizes='80px' }} {{/if}} diff --git a/templates/components/products/product-view.html b/templates/components/products/product-view.html index 241fa75652..eac5fb6329 100644 --- a/templates/components/products/product-view.html +++ b/templates/components/products/product-view.html @@ -56,6 +56,7 @@ lazyload=theme_settings.lazyload_mode default_image=theme_settings.default_image_product otherAttributes="data-main-image" + sizes=(concat (first (split theme_settings.product_size 'x')) 'px') }} {{!-- Remove the surrounding a-element if there is no main image. --}} {{#if product.main_image}} @@ -85,7 +86,8 @@ image=this fallback_size=../theme_settings.productview_thumb_size lazyload=../theme_settings.lazyload_mode - }} + sizes=(concat (first (split ../theme_settings.productview_thumb_size 'x')) 'px') + }} {{/each}} diff --git a/templates/layout/base.html b/templates/layout/base.html index 9ce3d896f1..aa9edc0416 100644 --- a/templates/layout/base.html +++ b/templates/layout/base.html @@ -24,7 +24,6 @@ window.lazySizesConfig = window.lazySizesConfig || {}; window.lazySizesConfig.loadMode = 1; - diff --git a/templates/pages/brand.html b/templates/pages/brand.html index 99b4af4160..cba8abf4b9 100644 --- a/templates/pages/brand.html +++ b/templates/pages/brand.html @@ -21,6 +21,7 @@ image=brand.image fallback_size=theme_settings.thumb_size lazyload='disabled' + sizes=(concat (first (split theme_settings.thumb_size 'x')) 'px') }} {{/if}} diff --git a/templates/pages/brands.html b/templates/pages/brands.html index 34e4cb51b1..8046489e44 100644 --- a/templates/pages/brands.html +++ b/templates/pages/brands.html @@ -22,6 +22,8 @@

{{lang 'brand.label'}}

fallback_size=../theme_settings.brand_size lazyload=../theme_settings.lazyload_mode default_image=../theme_settings.default_image_brand + sizes='320px' + sizes=(concat (first (split ../theme_settings.brand_size 'x')) 'px') }} diff --git a/templates/pages/category.html b/templates/pages/category.html index 570a093b9e..9614f28bb1 100644 --- a/templates/pages/category.html +++ b/templates/pages/category.html @@ -24,6 +24,7 @@ fallback_size=theme_settings.zoom_size lazyload=theme_settings.lazyload_mode class="category-header-image" + sizes=(concat (first (split ../theme_settings.zoom_size 'x')) 'px') }} {{/if}} {{#unless theme_settings.hide_category_page_heading }} diff --git a/templates/pages/compare.html b/templates/pages/compare.html index b6edecf213..d641776a8e 100644 --- a/templates/pages/compare.html +++ b/templates/pages/compare.html @@ -21,6 +21,7 @@

{{lang 'compare.header' products=comparisons.length}} diff --git a/webpack.common.js b/webpack.common.js index 7603dff18b..02da05b117 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -10,7 +10,6 @@ module.exports = { context: __dirname, entry: { main: './assets/js/app.js', - head_async: ['lazysizes'], polyfills: './assets/js/polyfills.js', }, module: { @@ -75,7 +74,6 @@ module.exports = { alias: { jquery: path.resolve(__dirname, 'node_modules/jquery/dist/jquery.min.js'), jstree: path.resolve(__dirname, 'node_modules/jstree/dist/jstree.min.js'), - lazysizes: path.resolve(__dirname, 'node_modules/lazysizes/lazysizes.min.js'), nanobar: path.resolve(__dirname, 'node_modules/nanobar/nanobar.min.js'), 'slick-carousel': path.resolve(__dirname, 'node_modules/slick-carousel/slick/slick.min.js'), 'svg-injector': path.resolve(__dirname, 'node_modules/svg-injector/dist/svg-injector.min.js'),