Usage:
jemplate --runtime
jemplate (--compile|--list) [options] template-list
Example:
Write the Jemplate runtime code into Jemplate.js, then compile all the template files in the templates/ directory and put the output in my-jemplate.js.
jemplate --runtime > Jemplate.js
jemplate --compile templates/* > my-jemplate.js
Do the same thing, but put the output into one file.
jemplate --runtime > my-jemplate.js
jemplate --compile templates/* >> my-jemplate.js
template-list:
The template-list is the list of template files that will be compiled. If something in the list is a file, then the template name will be just the file name. If it is a directory, then all the files under that directory will be found, and the relative paths to those files will be the template name.
So 'template/foo/bar.tt2' will be named 'bar.tt2', but 'template/' will find a template named 'foo/bar.tt2'.
It is important to know what Jemplate thinks the template name will be when you are writing templates or code that refers to other templates. Use the --list option to check this.
Commands:
-r, --runtime
This flag tells Jemplate to print the Jemplate JavaScript
runtime code to STDOUT. You should redirect this output into
a .js file.
-c, --compile
The --compile flag tells Jemplate to actually compile templates.
The output is written to STDOUT.
-l, --list
Just print (STDOUT) the template names that Jemplate would use
from the template-list.
IMPORTANT: The runtime code is also distributed as share/Jemplate.js, but this is deprecated and will be discontinued at some point. Please use the jemplate
command line tool with the --runtime
command, to create this file.
Template Toolkit Compile Options:
Jemplate allows you to specify the following Template Toolkit compile time options. Full descriptions of these options are available at http://www.template-toolkit.org/docs/plain/Manual/Config.html.
These options may either be set as JEMPLATE_* environment variables or as command line switches.
--start-tag (JEMPLATE_START_TAG)
Specify the starting template delimiter to use. Default is '[%'.
--end-tag (JEMPLATE_END_TAG)
Specify the ending template delimiter to use. Default is '%]'.
--pre-chomp (JEMPLATE_PRE_CHOMP)
Chomp leading whitespace automatically. Default is off.
--post-chomp (JEMPLATE_POST_CHOMP)
Chomp trailing whitespace automatically. Default is off.
--trim (JEMPLATE_TRIM)
Trim leading and trailing whitespace. Default is off.
--any-case (JEMPLATE_ANYCASE)
Allow lower or mixed case for template directives. Default is off.
--eval (--noeval) (JEMPLATE_EVAL_JAVASCRIPT)
Allow the execution of raw JavaScript. Default is on.
Use --noexec to disallow it.
Jemplate Options:
These compile time options are specific to Jemplate.
-s, --source
Include the original template source code as a JavaScript
comment next to each compiled template.