Skip to content

Instantly share code, notes, and snippets.

@arbalest
Created June 17, 2014 20:13
Show Gist options
  • Save arbalest/765118a1e2af296ff8bc to your computer and use it in GitHub Desktop.
Save arbalest/765118a1e2af296ff8bc to your computer and use it in GitHub Desktop.
Underscore Templates: Handlebar-Style Configuration
/**
* templateSettings object to configure Underscore's template engine to use Mustache-like curly-brace syntax.
*/
_.templateSettings = {
evaluate: /\{\{#([\s\S]+?)\}\}/g, // {{# console.log("pikachu!") }}
interpolate: /\{\{[^#\{]([\s\S]+?)[^\}]\}\}/g, // {{ title }}
escape: /\{\{\{([\s\S]+?)\}\}\}/g, // {{{ title }}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment