3 ms·
It took a day to write my own Node.js static blog generator in a single script. The over architecture of Astro and other similar projects is absolutely epic. F
by russellbeattie 3y ago
It took a day to write my own Node.js static blog generator in a single script. The over architecture of Astro and other similar projects is absolutely epic.
First, read a bunch of static text files. Throw them all into RAM. This is amazingly fast. If you include meta data in the files, you don't need a database or JSON index. I use my own HTML document editor so I start with that and use JSDOM to parse and add in stuff like scripts or tags, but if you're an MD fanboy, that would be just as simple. I then use an EJS template to update the index pages and an RSS library to crank out a feed and an exec call to sync to my S3 server with a command to cloudfront to invalidate the cache. Its not even slightly optimized, and yet I would have to have hundreds of pages for this to take longer than 30 seconds.
If you have enough JS knowledge to use Astro, then you've got enough to write this sort of script.