connectivedx / Phoenix

http://connectivedx.github.io/Phoenix/
33 stars 5 forks source link

Adds JS module to support (very) simple, string based templating #160

Closed stoff closed 9 years ago

stoff commented 9 years ago

Module contains a constructor for a Template object, and exposes a method to get back a new Template object.

I've not added any requires for the module since it should be optional.

example usage:

var createTemplate = require('./modules/Template.js').createTemplate;
var templateFooBar = createTemplate('Replace this %foo% with %bar%');

console.log(templateFooBar.populate({foo: 'bar', bar: 'foo'}));
stoff commented 9 years ago

I believe a future improvement would be (as browser support comes online) to use the ES6 Template Strings for this purpose.

ajmueller commented 9 years ago

@elseloop this was merged into master. Just a heads up :smile:

Never mind, you reverted it. Carry on!

elseloop commented 9 years ago

Today I learned why you don’t merge PRs off-handedly while in the middle of a completely unrelated conversation, even though you've reviewed the code.

OH GOD WHAT HAVE I DONE?

Thanks for the heads up, @ajmueller.