jax 0.1.0

A mustache-like template compiler for D

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

This package provides sub packages which can be used individually:

jax:compiler - A mustache-like template compiler for D

jax:filters - Default run-time filters implemenation for Jax

jax:example - Jax template compiler example

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 formathtml - Escape for HTML and replace LF with
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
Sub packages:
jax:compiler, jax:filters, jax:example
0.1.0 2015-Sep-10
~master 2015-Sep-10
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 116 downloads total

Short URL: