Hacker News new | ask | show | jobs
by kissgyorgy 820 days ago
Until you try it out and realize the benefits!

- Type safe HTML: you get an exception instead of malformed HTML

- Truly reusable components: any Python web framework, component packages are truly reusable in any other projects. I never seen this with template engines.

- Huge productivity boost: not even close! No hunting for templates, no jumping between files, everything is in Python functions.

- Composable elements: you can nest things as much as you want, refactor very easily. Doing this with templates is not even possible, or such a pain I never did it.

- Storybook: There are a couple ones for Django, but they are clunky and not reusable at all.

I felt the same for a long time, but started thinking about a nice API. It took me months, but I finally got it: https://github.com/kissgyorgy/compone

2 comments

Yes, I quite like the idea of being able to run pyflakes/flake8/black/pytest/mypy over my "html templates", and benefiting from all the power that entails.
Try ruff [0] and get rid of flake and black

[0]: https://github.com/astral-sh/ruff

I'm aware of it, but it obscures functionality for my previous statement.
Insightful summary. Thx.