anytv-templater
A module for building content string from templates
Install
npm i anytv-templater@latest --save
Introduction
Simple example:
'use strict'; const templater = ;const i18n = ; // make sure i18n is loaded before passing it on templater// it will use a default `trans` function if i18n is not passed // on server.jstemplater; // call to buildtemplatermake // specify language explicitly language'en' // or derive using country/country code content /** * the keys are the template variables, values can be string/number/object * object value will be used to call i18n.trans */ email_body: trans: 'monetization-suspended-email' data: channel_name: rowchannel_name email_greetings: trans: 'email-greetings' thank_you: trans: 'thank-you' the_freedom_team: trans: 'the-freedom-team' our_mailing_address: trans: 'our-mailing-address' year: // will just build the whole string plus metadata ;
Todo
- Complete test cases
Contributing
Install the tools needed:
sudo npm i grunt -gnpm i
To compile the ES6 source code to ES5:
npm start
Running test
sudo npm i serve_me -gserve_me test/locales 8081npm test
License
MIT