What could be more pleasant than totally over-engineering your devblog resume when you're a Web Developer in 2024? π
Just because I love buidling that kind of stuff, rather than using a turnkey solution to generate that bunch of static HTML files I opted for... a Django-based setup!
So, in order to generate only a few HTML pages from Markdown sources, I had the pleasure to use all these wonderful technologies: β¨
- A Django project that parses my post in Markdown format, using Python Markdown and PyMdown Extensions.
- Pico.css for the base styling.
- DOMinate for the templating (the closest thing to JSX I could find in Python π).
- Live reloading in the browser, powered by django-browser-reload.
- Once the static files are generated via a custom command, they are deployed to GitHub Pages via ghp-import.
- A GitHub Action builds and deploys the static assets automatically on every push to the branch.
On top of that I've also used some classic Python and Django packages, such as:
$ ls -l .venv/lib/python3.12/site-packages/*/METADATA | wc -l
48
Probably is! β π
All is needed is the venerable-and-ubiquitous Make and Python 3.12 (via pyenv for instance).
$ pyenv use 3.12
$ make install # will create a virtual env in ".venv/"
$ make dev # starts the Django server on port 8000, with live reloading
To build the static assets (HTML, CSS, images...)
$ make build
In the CI pipeline powered by GitHub Actions, the whole process
(installing the dependencies, building the static Web assets, and pushing all these static files to the gh-pages
branch)
takes about 40 seconds which is not too bad. π
The code of this app is licensed under the MIT license.