es6-template-strings
Compile and resolve template strings notation as specified in ES6
Usage
var template = require('es6-template-strings');
console.log(template('Hello ${place.toUpperCase()}!', { place: "World" }));
var compile = require('es6-template-strings/compile')
, resolveToString = require('es6-template-strings/resolve-to-string')
, compiled = compile('Welcome to ${siteName}, you are visitor number ${visitorNumber}!');
console.log(resolveToString(compiled, { siteName: "MySite", visitorNumber: 137 }));
console.log(resolveToString(compiled, { siteName: "OtherSite", visitorNumber: 777 }));
var resolve = require('es6-template-strings/resolve');
var customTag = function (literals) {
};
customTag.apply(null, resolve(compiled, {}));
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