--- layout: layout.njk title: htmx - high power tools for html --- ## The `client-side-templates` Extension This extension supports transforming a JSON request response into HTML via a client-side template before it is swapped into the DOM. Currently three client-side templating engines are supported: * [mustache](https://github.com/janl/mustache.js) * [handlebars](https://handlebarsjs.com/) * [nunjucks](https://mozilla.github.io/nunjucks/) When you add this extension on an element, any element below it in the DOM can use one of three attributes named `-template` (e.g. `mustache-template`) with a template ID, and the extension will resolve and render the template the standard way for that template engine: * `mustache` - looks a mustache <script> tag up by ID for the template content * `handlebars` - looks in the `Handlebars.partials` collection for a template with that name * `nunjucks` - resolves the template by name via `nunjucks.render() The AJAX response body will be parsed as JSON and passed into the template rendering. ### Usage ```html
``` ### Source ### Full HTML Example To use the client side template, you will need to include htmx, the extension, and the rendering engine. Here is an example of this setup for Mustache using a [`