by mg · 4y ago · 0 comments
I did not find a solution that I like. I came to the conclusion that a solution should be file based and the tool that turns it into a website should be a single script:
# File based
The content, templates and assets should be stored as files on disk. No database should be involved.
# Single script
I don't think turning templates, content and assets into a website is a complex thing. Basically it just means some templating of the content according to the templates. A small script that I can easily read should be sufficient.
So I will probably write that script myself. Currently, I expect the templates to be what I call "simplified Twig style":
<!doctype html>
<head><title>{TITLE}</title></head>
<body>{CONTENT}</body>
</html>
The content will be plain HTML. With metadata in YAML similar to how Jekyll does it: ---
layout: post
title: Hello World
---
Hello world, this is my first blog post.
And this is my dog:
<img src="dog.jpg" alt="My dog">
Say the script that is creating the website from the templates, content and assets is called create.py. Then create.py is supposed to be something like 50 lines of Python for the first version. And to stay under 500 lines forever. Additional functionality can be achieved via plugins: ---
layout: post
title: Hello World
convert: markdown2html.py
---
Hello world, this is my first blog post.
And this is my dog:
 git clone https://github.com/statamic/cms.git
cd cms
git ls-files | wc
3133
find . -name '*.php' | xargs wc -l
...
225023 total
3133 files. 225023 lines of PHP code. Plus dependencies, which are not counted here.I am going for 1 file with 50 lines of code and no dependencies.
Using a project made of thousands of files and dependencies, there is way more maintenance ahead. Handling is slower and more cumbersome. If the project moves in a direction I don't like, maintaining a fork would be too much work.
I'm sure v3 is nicer though from the amount of times I've searched the docs with an issue and seen "fixed in v3".