Skip to content

alblandino/template-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

template-parser

Installation

npm install template-parser --save

Features

With this module you can use templates with handlebars to load data dynamically, imagine you have a help.hbs file and have a file with the same name help.json, you can use the data that you have stored in help.json and parse it into help.hbs

Example

  • project_folder
  • templates
    • hbs
      • help.hbs
    • json
      • help.json
  • main.js
  • package.json

help.json

    { "name" : "Joel" }

help.hbs

    My name is : {{name}}
var template = require('template-parser');

var test = template.parse('help');
console.log(test);

Using another template folder?

var template = require('template-parser');

var test = template.parse('help', { template_dir : 'other' });
console.log(test);

Using another hbs folder?

var template = require('template-parser');

var test = template.parse('help', { hbs_dir : 'other' });
console.log(test);

Using another json folder?

var template = require('template-parser');

var test = template.parse('help', { json_dir : 'other' });
console.log(test);

Want to contribute?

All help are more than welcome!

Pre-requesites

Development Workflow

  1. Fork this respository.
  2. Clone your fork and create a feature branch from develop. git clone git@github.com:/template-parser.git git fetch origin git checkout dev git checkout -b feature-<new_feature>
  3. Install development dependencies. npm install
  4. Code and be happy!
  5. Test your code using Mocha.
  6. Submit a pull request and thanks.

Questions? Hit me.

Tests

To run all tests:

npm test

Credits

template-parser was created by Joel A. Jaime for the world.

About

♻️ Template parser module with handlebars

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published