Skip to content
A mustache-like template compiler for D
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Jax - Mustache-like template compiler for D

Jax has been written mainly for use with vibe.d but it can be used in any other way.

Compiles source text/html into valid D source code ready for use as a mixin.


  • HTML compressor
  • Parametrized macros
  • Good and detailed error reporting
  • Supports languages
  • Can automatically re-compile known dependant files
  • Token-based cache-busting mechanism
  • Interpolation and translation tags will escape HTML by default


o|output-dir - Output directory
p|time - Display elapsed time at end
v|verbose - Verbose output
l|line-numbers - Keep line numbers for error reporting (disables compression)
d|dep-cache - Dependant-cache directory
g|dep-gen-only - Only generate dependant-cache, do not re-compile dependants
c|compress - Compress HTML in between template tags
j|search - Search path(s) to look for dependency files
t|token	- Token for token_url interpolation filter. Useful for cache-busting


{{& fileName }} - Include external file
{{&& fileName }} - Embed external file as mime-encoded content
{{* key, value; iterable }} {{key}} {{value}} {{/}} - Iterate any iteratable symbol - implemented as D foreach
{{? condition }} true case {{: [condition] }} else case {{/}}
{{% D code }} - Evaluate D code
{{! comment }} - Comment
{{ expr [| filters] }} - Write expression to output
{{~ "message-id"(["name": "moo"]) | filters }} - Translate message-id with arguments
{{# def myMacro(arg) }} macro text {{# arg}} {{#/}}
{{# myMacro("mooo") }} - Call a macro


none - Does nothing
lower - Lower case
upper - Upper case
html - Escape for HTML
format_html - Escape for HTML and replace LF with </br>
format_html_links - Escape HTML, replace LF with </br> and create links for URL-like text
js - Escape for Javascript
url - Escape for URL
token_url - Appends v=<token> query parameter to url

Check the example directory for a working example.


  • Add means to control whitespaces in-between template-tags
  • Add more configuration options
  • Improve HTML compressor
  • Profile and optimize
You can’t perform that action at this time.