commit 27c6370284aa179701cd59dfab1ee204569ef537
Author: massi <mdsiboldi@gmail.com>
Date: Mon, 15 Jul 2024 00:53:45 -0700
init commit
Diffstat:
14 files changed, 129 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,3 @@
+build
+.env
+**/#*#
+\ No newline at end of file
diff --git a/Makefile b/Makefile
@@ -0,0 +1,16 @@
+clean:
+ rm -r build
+build:
+ mkdir -p build/static
+ cp -r static build/
+ cp server-root/* build/
+ tsc --outDir build/js src/*.ts
+ ./make.lisp
+serve:
+ http-server build -p 8080 & while true; do \
+ make clean; \
+ make build; \
+ inotifywait -qre close_write .; \
+ done
+publish: build
+ scp -r build/* "${MASSIWORLD_HOST}:"
diff --git a/credits.txt b/credits.txt
@@ -0,0 +1 @@
+html boilerplate: https://www.matuzo.at/blog/html-boilerplate/
diff --git a/make.lisp b/make.lisp
@@ -0,0 +1,5 @@
+#!/usr/bin/sbcl --script
+
+(load "./src/main.lisp")
+(in-package #:spinneret)
+(mk-site)
diff --git a/server-root/favicon.ico b/server-root/favicon.ico
Binary files differ.
diff --git a/server-root/manifest.json b/server-root/manifest.json
@@ -0,0 +1,16 @@
+{
+ "name": "massi.world",
+ "icons": [
+ {
+ "src": "/assets/massi-world-192-192.png",
+ "type": "image/png",
+ "sizes": "192x192"
+ },
+ {
+ "src": "/assets/massi-world-192-192.png",
+ "type": "image/png",
+ "sizes": "192x192"
+ },
+ ],
+ "start_url": "/index.html"
+}
diff --git a/src/js-check.ts b/src/js-check.ts
@@ -0,0 +1,2 @@
+document.documentElement.classList.remove('no-js');
+document.documentElement.classList.add('js');
diff --git a/src/main.lisp b/src/main.lisp
@@ -0,0 +1,68 @@
+(load "~/quicklisp/setup.lisp")
+(ql:quickload "spinneret")
+(ql:quickload "local-time")
+
+(in-package #:spinneret)
+
+(defun header ()
+ (with-html
+ (:header
+ "massi world 🦝")))
+
+(defmacro with-page ((&key path title description img img-desc) &body body)
+ (let ((abs-path (format nil "https://massi.world~a" path)))
+ `(with-html
+ (:doctype)
+ (:html.no-js
+ (:head
+ (:meta :charset "UTF-8")
+ (:meta :name "viewport" :content "width=device-width, initial-scale=1")
+ (:title ,title)
+ (:script :type "module" :src "/js/js-check.js")
+ (:link :rel "stylesheet" :href "/static/style.css")
+ (:meta :name "description" :content ,description)
+ (:meta :property "og:title" :content ,title)
+ (when (and ,img ,img-desc)
+ (:meta :property "og:image" :content ,img)
+ (:meta :property "og:image:alt" :content ,img-desc))
+ (:meta :property "og:locale" :content "en_US")
+ (:meta :property "og:type" :content "website")
+ (:meta :property "og:url" :content ,abs-path)
+ (:meta :name "theme-color" :content "#000033")
+ (:link :rel "canonical" :href ,abs-path)
+ (:link :rel "shortcut icon" :href "/favicon.ico")
+ (:link :rel "icon" :type "image/png" :sizes "16x16" :href "/static/massi-world-16-16.png")
+ (:link :rel "icon" :type "image/png" :sizes "32x32" :href "/static/massi-world-32-32.png")
+ (:link :rel "icon" :type "image/png" :sizes "48x48" :href "/static/massi-world-48-48.png")
+ (:link :rel "apple-touch-icon" :href "/static/massi-world-180-180.png")
+ (:link :rel "manifest" :href "/manifest.json"))
+ (:body ,@body)))))
+
+(defun mk-home (path)
+ (with-page (:path path :title "Home page" :description "My website.")
+ (header)
+ (:section
+ (:h2 "web projects")
+ (:ul
+ (:li (:a :href "/color-synth" "color-synth"))))
+ (:footer ("Last generated: ~A" (local-time:now)))))
+
+(defun mk-page (&key path maker)
+ (let* ((out-dir "build/")
+ (out-file (format nil "~{~A~}" `(,out-dir ,path))))
+ (ensure-directories-exist out-file)
+ (with-open-file (str out-file
+ :direction :output
+ :if-exists :supersede
+ :if-does-not-exist :create)
+ (setf *always-quote* t)
+ (format str (with-output-to-string (*html*) (funcall maker path))))))
+
+(defparameter sitespec
+ '(("index.html" mk-home)))
+
+(defun mk-site ()
+ (loop for pagespec in sitespec
+ for path = (first pagespec)
+ for maker = (second pagespec)
+ do (mk-page :path path :maker maker)))
diff --git a/static/massi-world-16-16.png b/static/massi-world-16-16.png
Binary files differ.
diff --git a/static/massi-world-180-180.png b/static/massi-world-180-180.png
Binary files differ.
diff --git a/static/massi-world-192-192.png b/static/massi-world-192-192.png
Binary files differ.
diff --git a/static/massi-world-32-32.png b/static/massi-world-32-32.png
Binary files differ.
diff --git a/static/massi-world-48-48.png b/static/massi-world-48-48.png
Binary files differ.
diff --git a/static/style.css b/static/style.css
@@ -0,0 +1,17 @@
+:root {
+ --light: #99ccff;
+ --dark: #001133;
+}
+
+@media (prefers-color-scheme: dark) {
+ html {
+ background: var(--dark);
+ color: var(--light);
+ }
+}
+@media (prefers-color-scheme: light) {
+ html {
+ color: var(--dark);
+ background: var(--light);
+ }
+}