es6-template-strings
Compile and resolve template strings notation as specified in ES6
Usage
Basic example:
var template = ; // Hello WORLD!console; // You can reuse same templates:var compile = resolveToString = compiled = ; // Welcome to MySite, you are visitor number 137!console; // Welcome to OtherSite, you are visitor number 777!console; // You may prepare custom tag functionsvar resolve = ; var { // Process input and return result string}; // Output template processed by customTag:customTag;
Partial resolution of a template
With partial: true
option, it's possible to resolve just some variables from a template.
It's useful when we want to resolve template in more than one pass.
var partialTemplate = ; // Hello WORLD! Today is ${day} ; // Hello WORLD! Today is Tuesday // Same way `partial` option can go to any resolve* util, e.g.:;
Installation
NPM
In your project path:
$ npm install es6-template-strings
Browser
You can easily bundle es6-template-strings for browser with modules-webmake
Tests
$ npm test