@amjs/templater

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

Usage no npm install needed!

<script type="module">
  import amjsTemplater from 'https://cdn.skypack.dev/@amjs/templater';
</script>

README

@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