Home

Awesome

octet npmjs.com The MIT License

1kb template engine for the browser and nodejs. Support helpers, partials and more.
Used in AbsurdJS Apps.

code climate standard code style travis build status coverage status dependency status

Install

npm i octet --save

Features

Use it

Usage

For more use-cases see the tests.
You can use any "helpers" lib, for example utils.

var octet = require('octet')
var utils = require('utils')

octet.render('foo <%this.uppercase("bar")%> baz', utils._)
//=> 'foo BAR baz'

octet

Acts like .render by default. Renders given str with locals.

Example

octet('foo <%this.bar%> baz <%this.quux%>', {bar: 'bar', quux: 'QUUX'})
//=> 'foo bar baz QUUX'

.render

Renders given str with locals.

Example

octet.render('Hello <%this.place%> and <%this.user.name%>!', {
  place: 'world',
  user: {
    name: 'Charlike'
  }
})
//=> 'Hello world and Charlike!'

.compile

Compiles given string and returns function which accepts locals object.

Example

var fn = octet.compile('Hello <%this.place%> and <%this.user.name%>!')
fn({place: 'world', user: {name: 'Charlike'}})
//=> 'Hello world and Charlike!'

Related

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github