2.0.1 • Published 5 years ago
backplate v2.0.1
backplate
backtick (`) templates
tiny template engine using JavaScript's built-in template strings
NOTE: this is probably NOT SAFE FOR UNTRUSTED INPUT
import
node
install with
npm install backplateor
yarn add backplateand import with
const { compile, render } = require('backplate')or
import { compile, render } from 'backplate'deno
import { compile, render } from 'https://denopkg.com/ahdinosaur/backplate@main/src/mod.ts'usage
template = compile(source)
const source = 'Hello ${world}!'
const template = compile(source)
const data = { world: 'Earth' }
const string = template(data)
console.log(string)
// Hello Earth!render(source, data)
const source = 'Hello ${world}!'
const data = { world: 'Earth' }
const string = render(source, data)
console.log(string)
// Hello Earth!