Skip to content

aklaswad/armtee

Repository files navigation

armtee

Line oriented text template tool

Test codecov

Install

npm i armtee

Synopsis

As ES module

import {Armtee} from 'armtee'

const data = [
  { name: 'Alice' },
  { name: 'Bob' }
]

const tmpl = `
##! for (let user of data) {
 - <% user.name %>
##! }
`
console.log(await Armtee.render(tmpl,data))
// - Alice
// - Bob

Common JS

const Armtee = require('armtee').Armtee
const data = [
  { name: 'Alice' },
  { name: 'Bob' }
]

const tmpl = `
##! for (let user of data) {
 - <% user.name %>
##! }
`
Armtee.render(tmpl,data)
  .then( rendered => console.log(rendered))
// - Alice
// - Bob

On browser

<script src="./dist/index.umd.cjs"></script>
<script>
const data = [
  { name: 'Alice' },
  { name: 'Bob' }
]

const tmpl = `
##! for (let user of data) {
 - <% user.name %>
##! }
`

armtee.Armtee.render(tmpl,data)
  .then(rendered => console.log(rendered))
</script>

See Live demo and document for more details.

About

Line oriented text template engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published