SkillAgentSearch skills...

Tickplate

Back-tick template engine for JavaScript πŸ’¬

Install / Use

/learn @metarhia/Tickplate

README

Tickplate - Back-tick templates for JavaScript

ci status snyk npm version npm downloads/month npm downloads

Zero-dependency back-tick templates using property names instead of expressions. Part of the Metarhia stack.

Installation

npm install tickplate

Usage

Place tag t before a template literal. Placeholders use property names (strings) as keys; pass a data object to the returned function to render.

const t = require('tickplate');

const data = {
  hello: 'Ave!',
  myFriend: {
    name: 'Marcus Aurelius',
    toString() {
      return this.name;
    },
  },
  positions: ['emperor', 'philosopher', 'writer'],
};

const templ = t`${'hello'} ${'myFriend'}, great ${'positions'} of Rome`;

console.log(templ(data));
// Ave! Marcus Aurelius, great emperor, philosopher, writer of Rome

ESM

import t from 'tickplate';

const templ = t`Hello ${'name'}!`;
console.log(templ({ name: 'World' }));
// Hello World!

API

t(strings, ...keys)

Tagged template literal. Returns a function (values, opts?) => string.

  • Placeholders: ${'key'} β€” property name from the data object.
  • Default values: ${'key=value'} β€” JSON-parsable default when the key is missing. Example: ${'greeting="Hello"'} or ${'count=0'}.
  • Arrays: Values are joined with , by default. Use opts.delimiter to customize (e.g. { delimiter: ', ' }).

templ(values, opts?)

Renders the template.

  • values: Data object. Keys not present render as empty string. null and undefined are treated as {}.
  • opts.delimiter: String (or coercible value) used to join array elements. Default: ','.

Examples

With delimiter

console.log(templ(data, { delimiter: ', ' }));
// Ave! Marcus Aurelius, great emperor, philosopher, writer of Rome

With default values

const templ = t`${'greeting='} ${'person="Marcus Aurelius"'}, great ${'positions=["emperor", "philosopher"]'} of Rome from ${'ruleFrom=161'} to ${'ruleTo=180'} AD`;

const data = {
  greeting: 'ValΔ“!',
  person: {
    name: 'Lucius Verus',
    toString() {
      return this.name;
    },
  },
  positions: ['brother', 'emperor', 'co-emperor'],
  ruleFrom: 161,
  ruleTo: 169,
};

console.log(templ(data));
// ValΔ“! Lucius Verus, great brother,emperor,co-emperor of Rome from 161 to 180 AD

License & Contributors

Copyright (c) 2017-2026 Metarhia contributors. Tickplate is MIT licensed. Tickplate is a part of Metarhia technology stack.

View on GitHub
GitHub Stars34
CategoryDevelopment
Updated20d ago
Forks1

Languages

JavaScript

Security Score

95/100

Audited on Mar 13, 2026

No findings