Using spacebars for user-generated mustache tags?

Hi folks,

I am working on an app that is sort of like an email newsletter tool (MailChimp, Campaign Monitor, etc). In the app, I would like users to be able to add dynamic tags in their content (not the application itself – just database values stored as a string).

For example, the application will have a form “Create message” where a user might type “Hi {{first_name}}, here's our newsletter.

I would expect this to output in a message to a contact in the database as, “Hi Allen, here’s our newsletter.”

So my question is: can I use spacebars.js to parse the string and look for tags, or should I turn to another method, like mustache.js?

Thanks for any feedback!

As a follow-up, I did end up installing mustache.js and it worked perfectly. But would still like to know if I could re-use spacebars that’s already installed without adding another dependency.

Check out the following package

1 Like

Thanks, will do! That looks like just what I need.