Description
For more advanced usage check the t_test.html.
This software is released under the MIT license.
t.js alternatives and similar libraries
Based on the "Templating Engines" category.
Alternatively, view t.js alternatives based on common mentions on social networks and blogs.
-
eleventy 🕚⚡️
A simpler site generator. Transforms a directory of templates (of varying types) into HTML. -
nunjucks
A powerful templating engine with inheritance, asynchronous control, and more (jinja2 inspired) -
doT
The fastest + concise javascript template engine for nodejs and browsers. Partials, custom delimiters and more. -
swig
DISCONTINUED. A simple, powerful, and extendable Node.js and browser-based JavaScript template engine. -
JavaScript-Templates
DISCONTINUED. 1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers. -
eta (η)
Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript -
squirrelly
Semi-embedded JS template engine that supports helpers, filters, partials, and template inheritance. 4KB minzipped, written in TypeScript ⛺
SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of t.js or a related project?
Popular Comparisons
README
t.js
A tiny javascript templating framework in ~400 bytes gzipped
t.js
is a simple solution to interpolating values in an html string for insertion into the DOM via innerHTML
.
Features
- Simple interpolation:
{{=value}}
- Scrubbed interpolation:
{{%unsafe_value}}
- Name-spaced variables:
{{=User.address.city}}
- If/else blocks:
{{value}} <<markup>> {{:value}} <<alternate markup>> {{/value}}
- If not blocks:
{{!value}} <<markup>> {{/!value}}
- Object/Array iteration:
{{@object_value}} {{=_key}}:{{=_val}} {{/@object_value}}
- Multi-line templates (no removal of newlines required to render)
- Render the same template multiple times with different data
- Works in all modern browsers
How to use
var template = new t("<div>Hello {{=name}}</div>");
document.body.innerHtml = template.render({name: "World!"});
For more advanced usage check the t_test.html
.
This software is released under the MIT license.
Coffeescript version maintained by @davidrekow
PHP version maintained by @ramon82
*Note that all licence references and agreements mentioned in the t.js README section above
are relevant to that project's source code only.