Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…lfinance into feature/optimization
  • Loading branch information
Vaibhav sasulkar committed Oct 11, 2024
2 parents 9851daa + 48192e6 commit e92720a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/aem.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ function createOptimizedPicture(
const source = document.createElement('source');
if (br.media) source.setAttribute('media', br.media);
source.setAttribute('type', 'image/webp');
source.setAttribute('srcset', `${pathname}?width=${br.width}&format=webply&optimize=medium`);
// source.setAttribute('srcset', `${pathname}?width=${br.width}&format=webply&optimize=medium`);
source.setAttribute('srcset', `${pathname}`);
picture.appendChild(source);
});

Expand All @@ -348,14 +349,16 @@ function createOptimizedPicture(
if (i < breakpoints.length - 1) {
const source = document.createElement('source');
if (br.media) source.setAttribute('media', br.media);
source.setAttribute('srcset', `${pathname}?width=${br.width}&format=${ext}&optimize=medium`);
// source.setAttribute('srcset', `${pathname}?width=${br.width}&format=${ext}&optimize=medium`);
source.setAttribute('srcset', `${pathname}`);
picture.appendChild(source);
} else {
const img = document.createElement('img');
img.setAttribute('loading', eager ? 'eager' : 'lazy');
img.setAttribute('alt', alt);
picture.appendChild(img);
img.setAttribute('src', `${pathname}?width=${br.width}&format=${ext}&optimize=medium`);
// img.setAttribute('src', `${pathname}?width=${br.width}&format=${ext}&optimize=medium`);
img.setAttribute('src', `${pathname}`);
}
});

Expand Down

0 comments on commit e92720a

Please sign in to comment.