ibra

1.0.3 • Public • Published

Ibra Build Status

Install

  npm i ibra --save

Ibra is a performant templating engine for javascript that uses markdown syntax to define structure. Lodash style templates can be used to process logic in your markdown files. Essentially, mix markdown syntax and lodash templating for rendering HTML.

For information on using lodash templates visit the lodash documentation

Usage

Use @{ and @} for defining blocks that should be evaluated as lodash templates.

const text = `# @{
                <%=name %>
              @}
 
              @{
                <ul>
                <% for (var i = 1; i <= 10; i++) { %>
                  <li><%=i%></li>
                <% } %>
                </ul>
              @}`
 
const data = {name: 'tom'}
const ibra = require('ibra')
const html = ibra(content, data)
 
/* 
  html becomes: 
  
  <h1>tom</h1>
  <ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>
    ...
  </ul>'
*/

Contributing

Fork this repository and run npm install in project directory.

Tests

npm run test

Package Sidebar

Install

npm i ibra

Weekly Downloads

1

Version

1.0.3

License

MIT

Last publish

Collaborators

  • dannav