This commit is contained in:
41666 2023-09-30 23:40:24 -04:00
commit 3e2e41b86a
15 changed files with 500 additions and 0 deletions

33
generators/generate.js Normal file
View file

@ -0,0 +1,33 @@
import { unlinkSync } from "fs";
import { globSync } from "glob";
const allHtmls = globSync("html/*.html").filter(
(file) => file !== "html/index.html"
);
for (const htmlFile of allHtmls) {
unlinkSync(htmlFile);
}
const indexTemplate = await Bun.file("generators/index.html.template").text();
const workTemplate = await Bun.file("generators/work.html.template").text();
const allWorks = globSync("html/*.js")
.map((file) => file.replace("html/", "").replace(".js", ""))
.filter((work) => work !== "platform");
console.log({ allWorks });
for (const work of allWorks) {
const html = `${workTemplate}`.replace(/##name##/g, work);
await Bun.write(`html/${work}.html`, html);
}
const index = indexTemplate.replace(
"<!--/INSERT/-->",
allWorks.map((work) => `<li><a href="/${work}">./${work}</a></li>`).join("\n")
);
await Bun.write("html/index.html", index);
console.log(`index.html generated. ${allWorks.length} works found.`);

View file

@ -0,0 +1,57 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>com.mekanoe.art //</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible&display=swap"
rel="stylesheet"
/>
<style>
html,
body {
font-family: "Atkinson Hyperlegible", sans-serif;
background-color: hsl(32, 19%, 14%);
color: hsl(39, 75%, 51%);
line-height: 1.5;
text-shadow: 1px 1px 3px hsl(38, 45%, 22%);
}
a {
color: inherit;
text-decoration: none;
}
ul {
list-style: none;
padding: 0;
margin: 0;
padding-left: 1rem;
}
li {
&:hover {
color: hsl(39, 100%, 80%);
& a {
text-decoration: underline;
}
}
&::before {
content: "▸";
margin-right: 0.5rem;
}
}
</style>
<link rel="stylesheet" href="index.css" />
<main>
<header>
<div>com.mekanoe.art //</div>
<div class="subtext">a collection of 3D works</div>
</header>
<section id="works">
<ul>
<!--/INSERT/-->
</ul>
</section>
</main>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>com.mekanoe.art // ##name##</title>
<style>
canvas {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
z-index: -1;
}
</style>
<link rel="stylesheet" href="index.css" />
<main>
<canvas id="canvas"></canvas>
</main>
<script src="/platform.js"></script>
<script src="/##name##.js"></script>