0.1.7 • Published 3 years ago

@amjs/templater v0.1.7

Weekly downloads
10
License
MIT
Repository
github
Last release
3 years ago

@amjs/templater 0.1.6

version

Running Handlebars, completes a template and returns its content in plain text

Installation

$ npm i @amjs/templater

Usage

With Handlebars file

{{!-- HandlebarsFile.hbs --}}
Value is: {{value}}
// Using Handlebars file
const path = require('path');
const templater = require('@amjs/templater');
const hbsFile = path.resolve('HandlebarsFile.hbs');

console.log(templater(hbsFile, { value: 1000 }));
// Value is: 1000

With Handlebars-like plain text template

// Using Handlebars file
const templater = require('@amjs/templater');
const template = 'Value is: {value}}';

console.log(templater(template, { value: 1000 }));
// Value is: 1000