1.0.2 • Published 1 year ago

@deyan.d/chops v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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 --save
yarn add @deyan.d/chops

Usage

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