JEMPLATE(1)
πΈ JEMPLATE(1) β user contributed perl documentation πΈ
okay bestie, gather round π this is the manual page for jemplate, living its best life over in the User Contributed Perl Documentation section of your man pages. It compiles your Template Toolkit templates into JavaScript, and honestly? it ate. let's go. π¦
β¨ USAGE β¨
here's every way you can run this thing, in order, no notes:
jemplate --runtime [runtime-opt]
jemplate --compile [compile-opt] template-list
jemplate --runtime [runtime-opt] --compile [compile-opt] template-list
jemplate --list template-list
Where --runtime and runtime-opt can include:
--runtimeβ Equivalent to--ajax=ilinsky --json=json2--runtime=standardβ that's it, that's the option π--runtime=liteβ Same as--ajax=none --json=none--runtime=jqueryβ Same as--ajax=jquery --json=none--runtime=yuiβ Same as--ajax=yui --json=yui--runtime=legacyβ Same as--ajax=gregory --json=json2--jsonβ By itself, equivalent to--json=json2--json=json2β Includehttp://www.json.org/json2.jsfor parsing/stringifying--json=yuiβ Use YUI:YAHOO.lang.JSON(requires external YUI)--json=noneβ Doesn't provide any JSON functionality except a warning--ajaxβ By itself, equivalent to--ajax=xhr--ajax=jqueryβ Use jQuery for Ajax get and post (requires external jQuery)--ajax=yuiβ Use YUI:yui/connection/connection.js(requires external YUI)--ajax=xhrβ UseXMLHttpRequest(will automatically use--xhr=ilinskyif--xhris not set)--ajax=noneβ Doesn't provide any Ajax functionality except a warning--xhrβ By itself, equivalent to--xhr=ilinsky--xhr=ilinskyβ Includehttp://code.google.com/p/xmlhttprequest/--xhr=gregoryβ Includehttp://www.scss.com.au/family/andrew/webdesign/xmlhttprequest/--xxxβ IncludeXXXandJJJhelper functions--compactβ Use theYUICompressorcompacted version of the runtime
Where compile-opt can include:
--start-tag--end-tag--pre-chomp--post-chomp--trim--any-case--eval--noeval-s,--source--exclude
See below for more information π (and yes, we do get to all of them, don't worry)
π Example
say you wanna write the Jemplate runtime code into Jemplate.js, and then compile every single template file chillin' in the templates/ directory and drop the output into my-jemplate.js. say less:
jemplate --runtime > Jemplate.js
jemplate --compile templates/* > my-jemplate.js
now do the exact same thing, but squish the output into one single 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's 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're writing templates or code that refers to other templates. Use the --list option to check this. fr fr, do not skip this step.
π COMMANDS π
-r,--runtimeβ This flag tells Jemplate to print the Jemplate JavaScript runtime code toSTDOUT. You should redirect this output into a.jsfile.-c,--compileβ The--compileflag tells Jemplate to actually compile templates. The output is written toSTDOUT.-l,--listβ Just print (STDOUT) the template names that Jemplate would use from thetemplate-list.
π TEMPLATE TOOLKIT COMPILE OPTIONS π
Jemplate lets you 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--noevalto disallow it.
π₯ JEMPLATE OPTIONS π₯
These compile time options are specific to Jemplate, no cap.
-s,--sourceβ Include the original template source code as a JavaScript comment next to each compiled template.--excludeβ Exclude any file matching the given regular expression.
and that's the whole page, bestie π you're officially a Jemplate girlie now π
this has been perl v5.42.0, dated 2025-07-25, brought to you by JEMPLATE(1) β go forth and compile, and remember: if anyone asks, you were always this good at Unix π
π¦ where this page comes from
- fedora 43: perl-Jemplate 0.300-30.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms