Last active
April 29, 2022 01:39
-
-
Save HymanZHAN/142e387a13e9866a453af61d9fb7edef to your computer and use it in GitHub Desktop.
Some Handy HTML Snippets for Jinja2 Templates (updating)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Jinja For": { | |
"prefix": "jj-for", | |
"body": ["{% for ${2:element} in ${1:array} %}", "\t$0", "{% endfor %}"], | |
"description": "For loop in Jinja2" | |
}, | |
"Jinja If": { | |
"prefix": "jj-if", | |
"body": ["{% if ${1:expression} %}", "\t$0", "{% endif %}"], | |
"description": "If statement in Jinja2" | |
}, | |
"Jinja Else": { | |
"prefix": "jj-else", | |
"body": "{% else %}", | |
"description": "Else statement in Jinja2" | |
}, | |
"Jinja Extend": { | |
"prefix": "jj-extends", | |
"body": "{% extends \"${1:base.html}\" %}", | |
"description": "Template inheritance in Jinja2" | |
}, | |
"Jinja Block": { | |
"prefix": "jj-block", | |
"body": ["{% block ${1:block_name} %}", "\t$0", "{% endblock %}"], | |
"description": "Declare a block in Jinja2" | |
}, | |
"Jinja With": { | |
"prefix": "jj-with", | |
"body": [ | |
"{% with ${1:variable} = ${2:expression} %}", | |
"\t$0", | |
"{% endwith %}" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is to provide a more pleasant developer experience when coding Jinja2 templates for Flask applications. For VS Code users,
ctrl + ship + p
/cmd + shift + p
and search forConfigure User Snippets
. Select HTML for the file type and copy the above configuration into thehtml.json
file.