thomasKn / astro-shopify

A lightweight and powerful ecommerce starter theme to build headless Shopify storefronts with Astro.
https://astro-shopify.frontvibe.com
MIT License
332 stars 99 forks source link

Shopify images .webp #32

Closed micvolo closed 1 year ago

micvolo commented 1 year ago

First of all, thank you for the awesome work!

I think now Shopify supports .webp resizes. In your code there is a seciton at src/components/ShopifyImage.svelte that prevent webp images to be resized.

    // If image is a webp, remove the .webp extension from the url
    // (Shopify image transformations don't work with webp)
    if (image && image.url.includes(".webp")) {
      return `${image.url.replace(
        ".webp",
        ""
      )}&width=${width}&height=${height}`;
    }

I ve tried to add some webp images into my product list and i wasnt' able to load them properly. Commenting that code everything is ok.

I hope this helps! ;)

thomasKn commented 1 year ago

Hey @micvolo thanks for taking the time to write an issue! I just merged a PR so it should be fixed now.