4 ms·
A static site generator is just a build tool. You need some way to say what your output files are, and what source files are needed to create them. This is usua
by sago 9y ago
A static site generator is just a build tool. You need some way to say what your output files are, and what source files are needed to create them. This is usually hardcoded (with some parameters and ad-hoc hooks) in something like Jekyll, but could be specified with Make. I wrote a very simple timestamp checker in a couple of dozen lines of Python.
Then your scss/less->css is probably best done with the command line compiler, driven from your build tool.
And for HTML, take a template language you enjoy and write a simple driver script. If you want multiple templates, add metadata to your source files. In my case I want Markdown->HTML, using various templates, so I use YAML for the metadata, then Python's markdown compiler, and finally Jinja2 for templating. Again you can write the driver in a few dozen lines for your own purpose.
My build tools then calls The AWS API to send it to its S3 bucket, in most cases. But in one it commits to a github pages branch and pushes.
It is exceptionally simple to code your own static site generator, if you can do basic command line scripting. And doing it that way allows you to be very flexible and add things like uploading, version control, etc.
I think it's better off seen as a command line tool, than a special 'static blog generator' task. In general I think we are erring too far on the 'build a niche vertical app' rather than 'automate powerful general-purpose tools'.