Open gaytomycode opened 2 months ago
@gaytomycode this looks like a good addition to response types.
I'm wondering if it would be better to return a tuple from the route in the form (snippet, context)
, so you can also inject variables. Eg based on your code:
async def hello_htmx():
return "<h1>Hello, {{ =name }}</h1>", {"name": "HTML Snippet"}
Using context will also make injectors work also with snippets if needed.
@gi0baro thank you for your reply. your suggestion makes sense will include it. glad you think it's a good addition will work on it. :)
I am playing around with Emmett on a couple of production products and i use htmx a lot. i found a solution around to response with html snippets and i can add support for it in the framework if it's a good idea.
i also want to add things like an htmx extension that adds full htmx support to make using htmx easy with Emmett as well as the ability to respond with a fragment of the template file like
django-template-partials
orjinja2-fragments
. let me know guys if this is interesting i am happy to work on it.