Skip to content

Commit 1174adf

Browse files
committed
feat: Make the HTMX object available in templates as a global context
from edmondchuc#27
1 parent 6a1b62e commit 1174adf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: flask_htmx/htmx.py

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ def init_app(self, app: Flask):
2525
"""Initialise the extension with the Flask app object."""
2626
app.htmx = self
2727

28+
@app.context_processor
29+
def htmx_context_processor():
30+
return {"htmx": self}
31+
32+
2833
@property
2934
def boosted(self) -> bool:
3035
""":py:obj:`True` if the request came from an element with the `hx-boost`

0 commit comments

Comments
 (0)