Skip to content

Commit

Permalink
feat: jinja snippets (#301)
Browse files Browse the repository at this point in the history
* feat: jinja snippets

* Move jinja snippets to main snippet file

---------

Co-authored-by: Vetle Koppergård <89847536+vetlek@users.noreply.github.com>
  • Loading branch information
kmugEq and vetlek authored Sep 18, 2023
1 parent 7b754d0 commit 64860c8
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions snippets/snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -1679,5 +1679,50 @@
"{# noqa #}"
],
"description": ""
},
"IfBlockJinja": {
"prefix": "if",
"body": [
"{% if condition %}",
"\t$0",
"{% endif %}"
],
"description": "Insert a Jinja if block"
},
"IfElseBlockJinja": {
"prefix": "ifelse",
"body": [
"{% if condition1 %}",
"\t$1",
"{% elseif condition2 %}",
"\t$2",
"{% else %}",
"\t$3",
"{% endif %}"
],
"description": "Insert a Jinja if-else block"
},
"ForLoopJinja": {
"prefix": "for",
"body": [
"{% for item in items %}",
"\t$1",
"{% endfor %}"
],
"description": "Iterate over a list using a Jinja for loop"
},
"SetVariableJinja": {
"prefix": "set",
"body": [
"{%- set $1 = $2 -%}"
],
"description": "Set a variable in Jinja"
},
"IncludeTemplateJinja": {
"prefix": "include",
"body": [
"{%- include \"$1\" -%}"
],
"description": "Include a template in Jinja"
}
}

0 comments on commit 64860c8

Please sign in to comment.