Skip to content

Instantly share code, notes, and snippets.

@zzzgit
Created September 2, 2019 07:04
Show Gist options
  • Save zzzgit/2bb2ffe778a982051415c81b3c443015 to your computer and use it in GitHub Desktop.
Save zzzgit/2bb2ffe778a982051415c81b3c443015 to your computer and use it in GitHub Desktop.
const tmpl = require('lodash.template')
const tmplOption = {
evaluate: /{{([\s\S]+?)}}/g,
escape: /{{-([\s\S]+?)}}/g,
interpolate: /{{=([\s\S]+?)}}/g,
}
template(str) {
return tmpl(str, tmplOption)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment