adamchainz / django-htmx

Extensions for using Django with htmx.
https://django-htmx.readthedocs.io/
MIT License
1.57k stars 140 forks source link

readme should be clearer about how to use templatetag #128

Closed nerdoc closed 2 years ago

nerdoc commented 2 years ago

Package Version

git

Description

In the readme file there is a hint how to use the templatetag:

For Django Templates, load and use the template tag:

{% load django_htmx %}
{% django_htmx_script %}

It's not clear: do I need to include {% django_htmx_script %} too in every (sub)template where I want to use htmx? Or is it ok to do it once in the base template? For {{ django_htmx_script() }} you make it clearer, it's only needed in the base template.

Maybe you could improve that, for beginners...

adamchainz commented 2 years ago

IMO this sentence already covers it:

You probably want to include the relevant template tag after your htmx script tag.

This readme is not the place to explain every detail about including JavaScript in Django applications. Moreover there are many ways to skin the cat. Django-htmx already presumes you've got htmx working, so you how to add a template tag in the same place.

nerdoc commented 2 years ago

Oh, sorry to have asked, didn't want to disturb you. If you think your docs are perfect, that's fine for me. Open Source is about community, and if you don't want to make things more clearly, good. It's not about "every detail", and no, your line with "you probably want to" is not clear. I can look at the script myself, and see what it does. Yust wanted to help. But ok, it's your code.

adamchainz commented 2 years ago

Please don't take things so personally.

I've tweaked the wording in #129. I removed "probably" to be more assertive, and removed "in your base template" because that does presume a certain layout.

nerdoc commented 2 years ago

That's nice - didn't want to bump you neither... Thanks for telling me. And for improving the docs ;-)