
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
npm install jstpl
var jstpl = require("jstpl"),
loader = jstpl.fileLoader("./path/to/templates"),
compiler = jstpl.compiler(loader);
compiler.loadPlugins();
compiler.parse("firstFile.tpl");
compiler.parse("secondFile.tpl");
compiler.getCode(function(error, code) {
// code - compiled template
});
compiler.getFunction(function(error, fn) {
var out = fn("firstFile.tpl", {arg1: 12, arg2: "test"});
});
jstpl [--function=function_name] [--out=output_file.js] [--plugins=no] template1.tpl template2.tpl template3.tpl ...
<div class="book_list">
$each($books) |b| {
<a href="/book/$b.id|utils.html.escape">$b.name|utils.html.escape</a>
}
</div>
jstpl --out=books.tpl.js books.tpl
...
var books = [{ id: 1, name: "Игра в классики" }, { id: 1, name: "Игра в биссер" }]
var books_html = jstpl("books.tpl", { books: books })
...
## One-line comment
#*
Comment
\# \$ \\ \" - escaping
*#
$title ## Insert variable value
$test_fn($test, 1, "Заголовок: $title") ## Function call
## Call function with two arguments: first - array, second - hash
$test_fn2([1, 2, $title, "str"] {
color: "red",
name: "Test",
"$title": "Title"
})
## Call function "if" with argument and block. (see "plugins" dir)
$if($title) {
<div>$title</div>
}
## Create macro (user function).
## Second and thrid arguments have default values.
$lambda(my_fn) |arg1, arg2:"None", id:$utils.id()| {
<div id="$id" class="$arg1">$arg2</div>
}
## Call my_fn.
## Argument "id" passed by name.
$my_fn("cl", id:"my_id")
$str_fn()|utils.html.escape ## Equals $utils.html.escape($str_fn())
## See "plugins" directory for plugin examples.
FAQs
Template engine inspired by Apache Velocity
We found that jstpl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.