diff --git a/README.md b/README.md index b586607..6d1d6d0 100644 --- a/README.md +++ b/README.md @@ -1 +1,100 @@ -# staples +# Staples + +Staples is a minimal library that provides the power to allow you to create simple semantic templates and customize them with the addition of custom helpers. Staples is widely compatible with the basic Mustache and Handlebars models. + + + +## Installation + +```bash +npm i @dslak/staples +``` + +or, using YARN + +```bash +yarn add @dslak/staples +``` + + + +## Usage + +Once installed, the library must be included as well + +```javascript +const staples = require('@dslak/staples') +staples.printVersion() +``` + + + +Example of use with a basic template and a test input + +```javascript +const staples = require('@dslak/staples'); + +const input = { + "sections": [ + { + "name": "section1", + "elements": { + "val1": "value 1", + "val2": "value 2", + "val_html": "HTML" + } + }, + { + "name": "section2", + "elements": { + "if": true, + "unless": false + } + } + ] +}; + +const template = `{{sections.0.elements.val1}} + {{sections.0.elements.val2}} +