Skip to content

Instantly share code, notes, and snippets.

@brunosabot
Created February 27, 2022 12:29
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 brunosabot/d1415002ea8e916cee28ca5c11ef8803 to your computer and use it in GitHub Desktop.
Save brunosabot/d1415002ea8e916cee28ca5c11ef8803 to your computer and use it in GitHub Desktop.
import fs from "fs";
import path from "path";
const POSTS_PATH = path.join(process.cwd(), "posts");
const posts = fs
.readdirSync(POSTS_PATH)
.filter((path) => /\.mdx?$/.test(path))
.map((path) => fs.readFileSync(POSTS_PATH + "/" + path));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment