How to invoke Jinja processing in my card JS code?

If you’re still looking for a way to add template support to your custom card, I just released ha-nunjucks for this very purpose. It offers a much easier way to implement template supports in custom cards by using nunjucks and the frontend hass object. The caveat being that the syntax is sometimes slightly different and I have to reimplement all the Home Assistant template extensions in TypeScript.

While the method used by card-mod and mushroom is better, it is difficult to understand and implement. Implementing ha-nunjucks is as simple as a function call.

1 Like