Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/metarhia/tickplate
Back-tick template engine for JavaScript π¬
https://github.com/metarhia/tickplate
console format formatter html impress javascript metarhia nodejs render renderer strings template templating tick
Last synced: 3 days ago
JSON representation
Back-tick template engine for JavaScript π¬
- Host: GitHub
- URL: https://github.com/metarhia/tickplate
- Owner: metarhia
- License: mit
- Created: 2017-01-30T23:56:56.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-09-03T20:45:33.000Z (2 months ago)
- Last Synced: 2024-10-13T11:40:28.293Z (about 1 month ago)
- Topics: console, format, formatter, html, impress, javascript, metarhia, nodejs, render, renderer, strings, template, templating, tick
- Language: JavaScript
- Homepage: https://metarhia.com
- Size: 350 KB
- Stars: 33
- Watchers: 11
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
## Tickplate - Back-tick templates for JavaScript
[![ci status](https://github.com/metarhia/tickplate/workflows/Testing%20CI/badge.svg)](https://github.com/metarhia/tickplate/actions?query=workflow%3A%22Testing+CI%22+branch%3Amaster)
[![codacy](https://api.codacy.com/project/badge/Grade/69719502402b43598ffac0fd35f2192c)](https://www.codacy.com/app/metarhia/tickplate)
[![snyk](https://snyk.io/test/github/metarhia/tickplate/badge.svg)](https://snyk.io/test/github/metarhia/tickplate)
[![npm version](https://badge.fury.io/js/tickplate.svg)](https://badge.fury.io/js/tickplate)
[![npm downloads/month](https://img.shields.io/npm/dm/tickplate.svg)](https://www.npmjs.com/package/tickplate)
[![npm downloads](https://img.shields.io/npm/dt/tickplate.svg)](https://www.npmjs.com/package/tickplate)## Usage
- Install: `npm install tickplate`
- Require: `const t = require('tickplate');`
- Place tag `t` before templated string## Examples:
```js
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));
console.log(templ(data, { delimiter: ', ' }));
```With default values provided (optionally):
```js
const t = require('tickplate');const data = {
greeting: 'ValΔ!',
person: {
name: 'Lucius Aurelius Verus',
toString() {
return this.name;
},
},
positions: ['brother', 'emperor', 'co-emperor'],
ruleFrom: 161,
ruleTo: 169,
};const templ = t`${'greeting='} ${'person="Marcus Aurelius"'}, great ${'positions=["emperor", "philosopher"]'} of Rome from ${'ruleFrom=161'} to ${'ruleTo=180'} AD`;
console.log(templ(data));
```## License & Contributors
Copyright (c) 2017-2023 [Metarhia contributors](https://github.com/metarhia/tickplate/graphs/contributors).
Tickplate is [MIT licensed](./LICENSE).\
Tickplate is a part of [Metarhia](https://github.com/metarhia) technology stack.