commit 6d96d14

Artur Manuel  ·  2026-05-21 17:13:47 +0000 UTC
parent 15ec275
assets: make assets work a little bit better for us
10 files changed,  +130, -47
+56, -0
 1@@ -0,0 +1,56 @@
 2+/* Complementary Palette */
 3+:root {
 4+  /* Primary Colors */
 5+  --primary-0: #052861;
 6+  --primary-100: #0950c3;
 7+  --primary-200: #3c83f6;
 8+  --primary-300: #9ec1fa;
 9+  --primary-400: #cee0fd;
10+  
11+  /* Secondary Colors */
12+  --secondary-0: #613e05;
13+  --secondary-100: #c37c09;
14+  --secondary-200: #f6af3c;
15+  --secondary-300: #fad79e;
16+  --secondary-400: #fdebce;
17+  
18+  /* Accent Colors */
19+  --accent-0: #3b0f57;
20+  --accent-100: #771fad;
21+  --accent-200: #aa52e0;
22+  --accent-300: #d4a8f0;
23+  --accent-400: #ead4f7;
24+  
25+  /* Neutral Colors */
26+  --neutral-0: #17191c;
27+  --neutral-100: #3c4048;
28+  --neutral-200: #6b7280;
29+  --neutral-300: #a0a6b0;
30+  --neutral-400: #d8dadf;
31+}
32+
33+@media (prefers-color-scheme: light) {
34+  body {
35+    background: var(--neutral-400);
36+    color: var(--neutral-100);
37+  }
38+
39+  a {
40+    color: var(--accent-100)
41+  }
42+}
43+
44+@media (prefers-color-scheme: dark) {
45+  body {
46+    background: var(--neutral-0);
47+    color: var(--neutral-400);
48+  }
49+
50+  a {
51+    color: var(--accent-300)
52+  }
53+}
54+
55+td {
56+  padding: 0.5em 1em;
57+}
R assets/bigpoo.png => assets/images/bigpoo.png
+0, -0
+0, -0
+7, -1
 1@@ -34,6 +34,10 @@ var cmd = cli.Command{
 2 			Name:  "pages-dir",
 3 			Value: "./pages",
 4 		},
 5+		&cli.StringFlag{
 6+			Name:  "assets-dir",
 7+			Value: "./assets",
 8+		},
 9 		&cli.StringFlag{
10 			Name:  "output-dir",
11 			Value: "./output",
12@@ -69,7 +73,8 @@ func mainAction(ctx context.Context, c *cli.Command) error {
13 	if err := os.MkdirAll(outputDir, 0o700); os.IsNotExist(err) {
14 		return err
15 	}
16-	if err := ssg.FromAssets("./assets", outputDir); err != nil {
17+	assetsDir := c.String("assets-dir")
18+	if err := ssg.CopyDir(assetsDir, outputDir); err != nil {
19 		return err
20 	}
21 	markdown := goldmark.New(
22@@ -84,6 +89,7 @@ func mainAction(ctx context.Context, c *cli.Command) error {
23 		if err != nil {
24 			return err
25 		}
26+		defer f.Close()
27 		if err := ssg.BuildPage(f, name, path, page, markdown, templates, config, baseUrl, sidebar); err != nil {
28 			return err
29 		}
+8, -0
1@@ -0,0 +1,8 @@
2+---
3+title: The Dani Gallery
4+description: Here is where you can see all the dani's made throughout time
5+---
6+
7+## The First Modern Dani
8+
9+![A picture of a modern Dani, circa 202X](images/modern_dani.png)
+1, -1
1@@ -7,6 +7,6 @@ title: the dani museum
2 Check this shit out this peaks ---> [kid named shit](https://www.youtube.com/watch?v=u87oNgyIPvY)
3 *(TUFF!!)*
4 
5-![bigpoo](bigpoo.png) 
6+![A kitty, named bigpoo](images/bigpoo.png) 
7 
8 (*This is bigpoo, say hi to bigpoo 🥺)*
+0, -6
1@@ -1,6 +0,0 @@
2----
3-title: Test
4-description: Test
5----
6-
7-# {{ .Extra.test }} :)
+0, -36
 1@@ -1,36 +0,0 @@
 2-package ssg
 3-
 4-import (
 5-	"io"
 6-	"io/fs"
 7-	"log/slog"
 8-	"os"
 9-	"path/filepath"
10-)
11-
12-// i couldn't come up with a better name for the function without it being too verbose but bwaaa who cares ig ;w;
13-func FromAssets(assetsDir string, outputDir string) error {
14-	err := filepath.WalkDir(assetsDir, func(path string, d fs.DirEntry, err error) error {
15-		if err != nil {
16-			slog.Error("got err while reading path", "path", path, "err", err) // those who error :skull:
17-			return filepath.SkipDir
18-		}
19-		if d.IsDir() {
20-			return nil
21-		}
22-		destPath := filepath.Join(outputDir, filepath.Base(path))
23-		src, err := os.Open(path)
24-		if err != nil {
25-			return err
26-		}
27-		defer src.Close()
28-		dst, err := os.Create(destPath)
29-		if err != nil {
30-			return err
31-		}
32-		defer dst.Close()
33-		_, err = io.Copy(dst, src)
34-		return err
35-	})
36-	return err
37-}
+57, -0
 1@@ -0,0 +1,57 @@
 2+package ssg
 3+
 4+import (
 5+	"io"
 6+	"os"
 7+	"path/filepath"
 8+)
 9+
10+func CopyDir(source string, destination string) error {
11+	srcInfo, err := os.Stat(source)
12+	if err != nil {
13+		return err
14+	}
15+	if err := os.MkdirAll(destination, srcInfo.Mode()); err != nil {
16+		return err
17+	}
18+	entries, err := os.ReadDir(source)
19+	if err != nil {
20+		return err
21+	}
22+	for _, entry := range entries {
23+		entrySrc := filepath.Join(source, entry.Name())
24+		entryDest := filepath.Join(destination, entry.Name())
25+		if entry.IsDir() {
26+			if err := CopyDir(entrySrc, entryDest); err != nil {
27+				return err
28+			}
29+		} else {
30+			if err := CopyFile(entrySrc, entryDest); err != nil {
31+				return err
32+			}
33+		}
34+	}
35+	return nil
36+}
37+
38+func CopyFile(srcPath string, destPath string) error {
39+	info, err := os.Stat(srcPath)
40+	if err != nil {
41+		return err
42+	}
43+	src, err := os.Open(srcPath)
44+	if err != nil {
45+		return err
46+	}
47+	defer src.Close()
48+	dest, err := os.OpenFile(destPath, os.O_WRONLY|os.O_CREATE, info.Mode())
49+	if err != nil {
50+		return err
51+	}
52+	defer dest.Close()
53+	_, err = io.Copy(dest, src)
54+	if err != nil {
55+		return err
56+	}
57+	return nil
58+}
+1, -3
 1@@ -5,9 +5,7 @@
 2     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 3     <title>{{ .Title }}</title>
 4     <meta name="description" content="{{ .Description }}">
 5-		<style>
 6-  			td { padding: 0.5em 1em; }
 7-		</style>
 8+    <link href="css/style.css" rel="stylesheet">
 9   </head>
10   <body>
11     <p>{{ .Title }} | words words words words words</p>