1.0.2 • Published 3 years ago
@deyan.d/chops v1.0.2
Chops
Simple template engine similar to mustache.js and handlebars.js
Install
You can get Chops via npm or yarn.
npm install @deyan.d/chops --saveyarn add @deyan.d/chopsUsage
import { chop } from "./chop.ts";
const datatest = {
bread: "baguette",
cheese: "brie cheese",
};
const myTemplate = "I like to eat {{bread}} and {{cheese}}";
chop(myTemplate, dataset);
// Will render: 'I like to eat baguette and brie cheese'Templates
A chops string is a string that contains any number of chops tags. Tags are indicated by the double mustaches that surround them. {{person}}. Currently Chops supports only a single level depth of templating through the dataset.
Supported Environments
Handlebars has been designed to work in any ECMAScript 2020 environment. This includes
- Node.js
- Chrome
- Firefox
- Safari
- Edge