This minimalist static site generator pattern is only for JavaScript developers who want something small, fast, flexible, and comprehensible
Jan Miksovsky, creator of Web Origami, tries building a basic static site generator by hand.
His takeaways?
First, and most importantly
This was pretty fun.
Simplicity = velocity
It was easy to keep the entire process in my head, so I made steady progress the whole time. I don’t think I hit a single real roadblock or had to backtrack.
Bugs were trivial
because I was working with plain objects and functions, the bugs were easy to locate, diagnose, and fix.
Experience gained is reusable
There were a very few cases where I had to look up anything. In checking the Node.js docs, I did learn about the
fs.rm()function, a call I’d somehow overlooked before which removes both files and folders. I’ll now be able to apply that new knowledge in future projects instead of having invested in a niche API I might never use again.
Source code size
He did this same project earlier with Astro and compares the size of the source code:
- Plain JS: 22k
- Astro: 11k
And then once you factor in dependencies (node_modules):
- Plain JS: 22k
- Astro: 117Mb
Both produce the exact same output.
Understandable
Oh, and the best part of this SSG he made:
any intermediate or better JavaScript programmer can read and understand it — including future me!