Skip to content

Instantly share code, notes, and snippets.

@pwfisher
Last active March 23, 2021 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwfisher/609fbf09d628dba80c67a5d3ae3cfd58 to your computer and use it in GitHub Desktop.
Save pwfisher/609fbf09d628dba80c67a5d3ae3cfd58 to your computer and use it in GitHub Desktop.
Template string replacement token syntax -- compare and contrast conventions in lovable libraries and languages

Python

def greet(name):
    return f"Hello, {name}!"
greet('Fred')

Mustache

Mustache.render("Hello, {{name}}!", { name: 'Fred' });

Handlebars

const greet = Handlebars.compile("Hello, {{name}}!");
template({ name: "Fred" }));

Lodash

var greet = _.template('Hello, <%= name %>!');
greet({ 'name': 'Fred' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment