2.0.1 • Published 4 years ago

backplate v2.0.1

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
4 years ago

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 backplate

or

yarn add backplate

and 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!