armtee
v0.0.2
Published
Line oriented micro templating tool
Downloads
21
Maintainers
Readme
armtee
Line oriented text template tool
Install
Not yet shipped. Try from this repository...
$ git clone [email protected]:aklaswad/armtee.git
$ cd armtee
$ npm i .
$ npx armtee --help
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.