Skip to content

Instantly share code, notes, and snippets.

@oscarotero
Created September 10, 2023 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscarotero/c6404f36530cf989ec1ba65b75d41e9c to your computer and use it in GitHub Desktop.
Save oscarotero/c6404f36530cf989ec1ba65b75d41e9c to your computer and use it in GitHub Desktop.
Rename Lume files
import { walk } from "https://deno.land/std@0.201.0/fs/mod.ts";
for await (const entry of walk("./tests")) {
let { path } = entry;
if (path.match(/\.tmpl\.\w+$/)) {
if (path.includes("/_includes/") || path.includes("/_components/")) {
path = path.replace(/\.tmpl(\.\w+)$/, "$1");
} else {
path = path.replace(/\.tmpl(\.\w+)$/, ".page$1");
}
await Deno.rename(entry.path, path);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment