Skip to content

🎥 Make videos programmatically with React

get-subpaths

Jonny Burger7ba3f6d500c1
diff --git a/packages/docs/docs/paths/split-parts.md b/packages/docs/docs/paths/get-subpaths.md
similarity index 94%
rename from packages/docs/docs/paths/split-parts.md
rename to packages/docs/docs/paths/get-subpaths.md
index cf5109e597..3490ab145d 100644
--- a/packages/docs/docs/paths/split-parts.md
+++ b/packages/docs/docs/paths/get-subpaths.md
@@ -1,4 +1,5 @@
---
+image: /generated/articles-docs-paths-get-subpaths.png
title: getSubpaths()
crumb: "@remotion/paths"
---
diff --git a/packages/docs/extract-articles.mjs b/packages/docs/extract-articles.mjs
index 56b413e06a..3d574c4202 100644
--- a/packages/docs/extract-articles.mjs
+++ b/packages/docs/extract-articles.mjs
@@ -1,3 +1,4 @@
+import { execSync } from "child_process";
import fs from "fs";
import path from "path";
import { readDir } from "./get-pages.mjs";
@@ -64,6 +65,8 @@ fs.writeFileSync(
`export const articles = ` + JSON.stringify(data, null, 2)
);
+execSync("pnpm exec prettier src/data/articles.ts --write");
+
import { bundle } from "@remotion/bundler";
import { getCompositions, renderStill } from "@remotion/renderer";
@@ -76,16 +79,19 @@ const compositions = await getCompositions(serveUrl);
for (const entry of data) {
const composition = compositions.find((c) => c.id === entry.compId);
const output = `static/generated/${composition.id}.png`;
+ if (fs.existsSync(output)) {
+ console.log("Existed", composition.id);
+ continue;
+ }
+
+ const out = path.join(process.cwd(), entry.relativePath);
await renderStill({
composition,
output,
serveUrl,
});
- const fileContents = fs.readFileSync(
- path.join(process.cwd(), entry.relativePath),
- "utf-8"
- );
+ const fileContents = fs.readFileSync(out, "utf-8");
const lines = fileContents
.split("\n")
.filter((l) => !l.startsWith("image: "));
@@ -100,6 +106,6 @@ for (const entry of data) {
...lines.slice(frontmatterLine + 1),
].join("\n");
- fs.writeFileSync(path.join(process.cwd(), entry.relativePath), newLines);
+ fs.writeFileSync(out, newLines);
console.log("Rendered", composition.id);
}
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 46eeb874bb..6117dc0019 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -1086,6 +1086,13 @@ export const articles = [
compId: "articles-docs-paths-get-point-at-length",
crumb: "@remotion/paths",
},
+ {
+ id: "paths/get-subpaths",
+ title: "getSubpaths()",
+ relativePath: "docs/paths/get-subpaths.md",
+ compId: "articles-docs-paths-get-subpaths",
+ crumb: "@remotion/paths",
+ },
{
id: "paths/get-tangent-at-length",
title: "getTangentAtLength()",
@@ -1121,13 +1128,6 @@ export const articles = [
compId: "articles-docs-paths-reverse-path",
crumb: "@remotion/paths",
},
- {
- id: "paths/split-parts",
- title: "getSubpaths()",
- relativePath: "docs/paths/split-parts.md",
- compId: "articles-docs-paths-split-parts",
- crumb: "@remotion/paths",
- },
{
id: "performance",
title: "Performance Tips",
diff --git a/packages/docs/static/generated/articles-docs-paths-get-subpaths.png b/packages/docs/static/generated/articles-docs-paths-get-subpaths.png
new file mode 100644
index 0000000000..d240264015
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-paths-get-subpaths.png differ
diff --git a/packages/docs/static/generated/articles-docs-paths-split-parts.png b/packages/docs/static/generated/articles-docs-paths-split-parts.png
deleted file mode 100644
index 8e74f89a1f..0000000000
Binary files a/packages/docs/static/generated/articles-docs-paths-split-parts.png and /dev/null differ