mirror of
https://github.com/Yet-Another-DreamTeam/extended-markdown.git
synced 2026-03-13 08:09:40 +00:00
29 lines
919 B
JavaScript
29 lines
919 B
JavaScript
const { readdirSync, statSync, readFileSync } = require("fs");
|
|
const { join } = require("path");
|
|
|
|
function getFilesFromFolder(staticpath) {
|
|
let results = readdirSync(staticpath);
|
|
let folders = [];
|
|
let files = [];
|
|
results.forEach((result) => {
|
|
result = join(staticpath, result);
|
|
if (statSync(result).isDirectory()) {
|
|
folders.push(result);
|
|
const folderfiles = getFilesFromFolder(result);
|
|
folderfiles.forEach((folderfile) => files.push(folderfile));
|
|
} else if (statSync(result).isFile()) {
|
|
files.push(result);
|
|
}
|
|
});
|
|
return files;
|
|
}
|
|
|
|
let templatePaths = getFilesFromFolder(join(__dirname, "./templates"));
|
|
let componentPaths = getFilesFromFolder(join(__dirname, "./components"));
|
|
let templates = templatePaths.map((path) => {
|
|
return { path: path, data: readFileSync(path, "utf-8") };
|
|
});
|
|
|
|
console.log("Templates:", templates);
|
|
// console.log("Templates:", components);
|