htmx icon indicating copy to clipboard operation
htmx copied to clipboard

External client side templates

Open KaruroChori opened this issue 2 years ago • 0 comments

It is reported in the documentation that it should be possible to load external components: https://htmx.org/extensions/client-side-templates/#full-mustache-html-example

However I was not able to replicate this being possible, not for handlebars nor nunjucks.
Looking at the network activities, external script which are sourced in this way will never be loaded at any stage.
The same templates embedded in the script tags within the page will be properly rendered.

By the way, the example is showing template as the suggested tag to embed templates; while this can work sometimes, more complex cases do fail, like when using tables.
The strict HTML rules are fully applied to any content parsed within template before we hit the target rendered.
I think the example should reflect the usage of templates embedded in script tags instead.

KaruroChori avatar Dec 08 '23 15:12 KaruroChori