Skip to content

Commit

Permalink
Enable AVIF features
Browse files Browse the repository at this point in the history
  • Loading branch information
frankharkins committed Jan 10, 2025
1 parent 5cf6bb3 commit 71aa155
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 3 additions & 5 deletions scripts/js/lib/api/processHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,9 @@ export function loadImages(

// We convert PNG and JPG to AVIF for reduced file size. The image-copying
// logic detects changed extensions and converts the files.
// Remove `false &&` when ready to switch to AVIF
let dest =
false && [".png", ".jpg", ".jpeg"].includes(fileExtension)
? `${imageDestination}/${path.basename(fileName, fileExtension)}.avif`
: `${imageDestination}/${fileName}`;
let dest = [".png", ".jpg", ".jpeg"].includes(fileExtension)
? `${imageDestination}/${path.basename(fileName, fileExtension)}.avif`
: `${imageDestination}/${fileName}`;

if (isReleaseNotes && !hasSeparateReleaseNotes) {
// If the Pkg only has a single release notes file for all versions,
Expand Down
5 changes: 3 additions & 2 deletions scripts/js/lib/markdownImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ export async function collectInvalidImageErrors(
if (!node.alt || node.alt.endsWith(imageName!)) {
imagesErrors.add(`The image '${node.url}' does not have alt text.`);
}
// Remove `false &&` when ready to switch to AVIF
if (false && node.url.match(/\.(png|jpe?g)$/)) {

// Ask to convert PNG and JPEG to AVIF
if (node.url.match(/\.(png|jpe?g)$/)) {
const urlWithAvifExtension = node.url.replace(
/\.(png|jpe?g)$/,
".avif",
Expand Down

0 comments on commit 71aa155

Please sign in to comment.