perf(site): serve responsive WebP and compressed Hub videos
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { applyResponsiveImages } from "./responsive-images.mjs";
|
||||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
@@ -459,6 +460,7 @@ async function renderBlock(block, renderCounts) {
|
||||
description: "", imageSrc: "", imageAlt: "", videoSrc: "", posterSrc: "", ...item,
|
||||
detailsHref: safeArticleHref(item.detailsHref),
|
||||
detailsLabel: typeof item.detailsLabel === "string" && item.detailsLabel.trim() ? item.detailsLabel.trim() : "Подробнее",
|
||||
imageSizes: ["photo-gallery", "scenario-gallery"].includes(block.content.mediaKind) ? "(max-width: 767px) 82vw, 560px" : "(max-width: 767px) 86vw, 1280px",
|
||||
imageLinkEnabled: block.content.openImagesInFullscreen === true,
|
||||
imageLinkDisabled: block.content.openImagesInFullscreen !== true,
|
||||
}));
|
||||
@@ -544,3 +546,5 @@ await writeFile(outputPath, output);
|
||||
await writeSeoFiles(page);
|
||||
|
||||
console.log(`Rendered ${page.slug} -> ${outputPath}`);
|
||||
|
||||
await applyResponsiveImages(repoRoot);
|
||||
|
||||
Reference in New Issue
Block a user