recursiveReaddir
- accepts a path and uses fs.readdir
to create a .json
file containing a File[]
array where
type File = {
name: string;
contents: File[];
};
recursiveReaddir
is ran at build time to read the contents of ~/routes
and construct a file called data.json
representing the file structure of ~/routes
. This file is then passed into the navigation panel which is rendered server-side. If it's a directory, contents
will contain the files inside. If it's not a directory, contents
will be []
.
RecursiveAccordion
accepts this recursive structure defined in data.json
, calling
<Accordion>
<RecursiveAccordion files={file.contents} />
</Accordion>
if it is a directory and
<Link>{file.name}</Link>
if it is a markdown file. MDX will turn the markdown files (parsing LaTeX) into javascript bundles which Remix will serve at the Link
s. These bundles will be cached at Cloudflare HTTP edge servers.