inital setup

This commit is contained in:
Laurenz1606 2021-08-24 22:58:16 +02:00
parent 9f2f2b7bb7
commit adbcfca181
6 changed files with 41 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
input
output
node_modules

1
components/header.emd Normal file
View File

@ -0,0 +1 @@
# Header

28
index.js Normal file
View File

@ -0,0 +1,28 @@
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);

3
templates/Login.emd Normal file
View File

@ -0,0 +1,3 @@
<include>header</include>
# Login

3
templates/Register.emd Normal file
View File

@ -0,0 +1,3 @@
<include>header</include>
# Register

3
templates/sub/Index.emd Normal file
View File

@ -0,0 +1,3 @@
<include>header</include>
# Index