You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apologies ahead of time as I'm fairly new to django-components.
Context:
Let's say I have an index.html with {% component_css_dependencies %} and/or {% component_css_dependencies %} declared in the head/script sections, respectively. I have templates that extend index.html that contain templatetags for django-component modal. The modal django-component loads partial templates via HTMX.
Issue:
If the partial templates loaded via modal django-component/HTMX contain calls to other django-components (e.g., an input django-component), then the input django-component's JS/CSS dependencies are not loaded into head/script of index.html.
It seems any django-component's JS/CSS dependencies will only load if the component is explicitly declared via templatetag in index.html template (or any other template that extends index.html).
Request / Solution:
I think the behavior I'm looking to achieve is dynamic loading of JS/CSS dependencies based on the templatetag call, and a recursive search of the{% component_css/js_dependencies %} locations to load into.
The text was updated successfully, but these errors were encountered:
Hey @maximbelyayev thanks for taking the time to write this down and welcome!
I don't use HTMX + Django much, so to clarify, when you say "partial templates", do you mean HTML snippets that will be inserted into an already-existing HTML in the browser? So it's not a fully qualified HTML with <html> and <body>:
but instead only the snippet that will be rendered, e.g.
<div>
hello
...
</div>
And when it comes to dynamically loading JS/CSS, see the discussion at #478 (comment). There we talked about an idea of having a JS script that would manage and load CSS/JS on-demand. But we haven't flashed it out yet, so any feedback is welcome.
Hi @JuroOravec, yes exactly by 'partial templates' I mean snippets without a <html> and <body> that are injectable into templates with a head/body.
Good to know this was discussed already! I don't know if I can contribute but happy to tes/provide feedback if this feature or JS script does get implemented.
Apologies ahead of time as I'm fairly new to django-components.
Context:
Let's say I have an
index.html
with{% component_css_dependencies %}
and/or{% component_css_dependencies %}
declared in the head/script sections, respectively. I have templates that extendindex.html
that contain templatetags for django-componentmodal
. Themodal
django-component loads partial templates via HTMX.Issue:
If the partial templates loaded via
modal
django-component/HTMX contain calls to other django-components (e.g., aninput
django-component), then theinput
django-component's JS/CSS dependencies are not loaded into head/script ofindex.html
.It seems any django-component's JS/CSS dependencies will only load if the component is explicitly declared via templatetag in
index.html
template (or any other template that extendsindex.html
).Request / Solution:
I think the behavior I'm looking to achieve is dynamic loading of JS/CSS dependencies based on the templatetag call, and a recursive search of the
{% component_css/js_dependencies %}
locations to load into.The text was updated successfully, but these errors were encountered: