htmx icon indicating copy to clipboard operation
htmx copied to clipboard

documentation incorrect for client-side-templates using a mustache template in a file

Open oliverwi opened this issue 2 years ago • 3 comments
trafficstars

I am referring to https://htmx.org/extensions/client-side-templates/

Using the recommend <script src...> does not work for including a mustache template file. Also <script hx-get...> does not work other than when the mustache template contains only mustached tags (without HTML tags).

I got it working by means of a hidden div element with hx-get attribute.

oliverwi avatar Sep 09 '23 13:09 oliverwi

Working example using hidden <div> with hx-get attribute:

https://run.plnkr.co/preview/clmc26lc500082e6qq7m0lux0/index.html

oliverwi avatar Sep 09 '23 13:09 oliverwi

@oliverwi Just facing the same issue. Unfortunately, the link you shared does not work anymore. Would you mind sharing this again?

dominikb1888 avatar Nov 03 '23 13:11 dominikb1888

I'm having the same issue and I really thought that I did a mistake. So, do we know how to load external template files or no?

ASoldo avatar Jan 12 '24 01:01 ASoldo