Line oriented text template tool
npm i armtee
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
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
<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.