+ I'm a red dragon that mostly dabble in hobby programming and the occasional artwork. +
+Latest Updates
+-
+ { updates.map(update =>
- {update.title} )} +
Projects
+-
+ { projects.map(project =>
- {project.title} )} +
diff --git a/cli.js b/cli.js index f54821c..28b5f61 100644 --- a/cli.js +++ b/cli.js @@ -1,9 +1,23 @@ -import { index } from "./build/node/index.js" +import { pages } from "./build/node/content/pages.js" +import { prettify, htmlDocument } from "antihtml"; import * as fs from "node:fs" -if (!fs.existsSync("build/web")) { - fs.mkdirSync("build/web"); +const outDir = "build/web"; +if (!fs.existsSync(outDir)) { + fs.mkdirSync(outDir); } -console.log("writing build/web/index.html"); -fs.writeFileSync("build/web/index.html", index); +for (const page of pages) { + const dirSep = page.ref.indexOf("/"); + if (dirSep !== -1) { + const dir = `${outDir}/${page.ref.slice(0, dirSep)}`; + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir); + } + } + console.log(`writing ${outDir}/${page.ref}`); + fs.writeFileSync(`${outDir}/${page.ref}`, htmlDocument(prettify(page.content))); +} + +console.log(`writing ${outDir}/style.css`); +fs.writeFileSync(`${outDir}/style.css`, fs.readFileSync("public/style.css")); diff --git a/content/bases.tsx b/content/bases.tsx new file mode 100644 index 0000000..cf9f3ae --- /dev/null +++ b/content/bases.tsx @@ -0,0 +1,23 @@ +import type { Node } from "antihtml"; + +interface BaseProps { + title: string; + children: Node | Node[], +} +export function BasePage(props: BaseProps) { + return +
+ ++ I'm a red dragon that mostly dabble in hobby programming and the occasional artwork. +
+Placeholder content
+Published: {page.published}
+Placeholder content
+Hello world!
- - - ) -); diff --git a/public/style.css b/public/style.css new file mode 100644 index 0000000..2a364a9 --- /dev/null +++ b/public/style.css @@ -0,0 +1,92 @@ +/* CSS Reset based on https://piccalil.li/blog/a-more-modern-css-reset/ */ +*, +*::before, +*::after { + box-sizing: border-box; + /* Kill all default margins and paddings */ + margin: 0; + padding: 0; +} + +html { + -moz-text-size-adjust: none; + -webkit-text-size-adjust: none; + text-size-adjust: none; +} + +h1, h2, h3, h4, button, input, label { + line-height: 1.1; +} + +img, svg, picture { + max-width: 100%; + display: block; +} + +input, button, textarea, select { + font-family: inherit; + font-size: inherit; +} + +textarea:not([rows]) { + min-height: 10em; +} + +:target { + scroll-margin-block: 2.5em; +} + +/* Overall styling */ +html { + color-scheme: light dark; + font-family: sans-serif; +} + +hgroup h1 { + margin-bottom: 0.1em; +} +hgroup p { + font-style: italic; + margin-bottom: 1em; +} + +h1, h2, h3, h4 { + margin-block-start: 1.25em; + margin-block-end: 0.5em; +} + +ol, ul { + padding-inline-start: 1.25em; +} + +/* Base Page Layout */ +body { + max-width: 50rem; + padding: 0; + margin-block: 0; + margin-inline: auto; +} + +.header { + padding-block: 1em; +} + +.hero { + height: 30em; + background-color: grey; +} + +/* index */ +.author { + display: grid; + grid-template-columns: auto 1fr; + align-items: center; + gap: 1em; + margin-block: 1em; +} +.author h1 { + margin-block-start: 0; +} +.author p { + margin-block-end: 0; +} diff --git a/tsconfig.json b/tsconfig.json index 7a63bc6..69df90b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,8 @@ { - "files": ["index.tsx"], + "include": ["content"], "compilerOptions": { "outDir": "build/node", + "rootDir": ".", "jsx": "react-jsx", "jsxImportSource": "antihtml",