News for hackers. Stuff that matters.
Re:Andrej Karpathy on the State of Web Development by mg on Saturday March 29, 2025 @07:25AM (#43514602)
I think it is a balance. My current view on this is:

For the frontend, everything but plain HTML, CSS, JS is too much.

For the backend, an opinionated framework like Django is too much.

Even a less opinionated framework like Flask is too much.

Using modules that Flask uses - like Jinja templates - is the right choice for me. This way, I don't have the overhead of a full framework, but also don't have to write basics like a template engine myself. And I have the benefit that other developers (and AI) easily understand my code, as it has many similarities to a Flask project.

So instead of going for Flask when I need templates, all I do is

    import jinja2

    env = jinja2.Environment(
        loader=jinja2.FileSystemLoader('templates'),
        autoescape=jinja2.select_autoescape(['html', 'xml'])
    )

    def template_data(template, data):
        tmpl = env.from_string(template)
        return tmpl.render(data)
And I have a function I can use to template my data.

There are no comments on this comment yet.