muddle/editors/vscode/snippets/spug.json
2026-10-23 09:12:49 -04:00

88 lines
2.4 KiB
JSON

{
"Typed props": {
"prefix": "props",
"body": ["props", " ${1:name}: ${2:string}"],
"description": "Declare typed SPUG props"
},
"Optional prop": {
"prefix": "props?",
"body": ["props", " ${1:name}: ${2:string}?", ""],
"description": "Declare an optional SPUG prop"
},
"Relation anchor": {
"prefix": "anchor",
"body": ["${1:a}.class@${2:name}(${3:id})(${0})"],
"description": "Spawn a relation anchor consumed by $refer / :with / :when in STCSS"
},
"Dynamic anchor": {
"prefix": "anchor+",
"body": ["li@row(item.id)(${0})"],
"description": "Dynamic relation anchor from an each-loop item"
},
"TypeScript block": {
"prefix": "javascript",
"body": ["javascript!", " ${1:const value = true;}", "end"],
"description": "Embed a TypeScript block"
},
"HTML block": {
"prefix": "html-block",
"body": ["html!\n ${1:<p>raw</p>}\nend"],
"description": "Embed a raw HTML block"
},
"Component render": {
"prefix": "component",
"body": [
"component ${1:name}",
" ${2:prop}: ${3:value}",
" render ${4:slot}",
" ${0}",
" end? (see docs)"
],
"description": "Render a component with props and a slot"
},
"Extend layout": {
"prefix": "extends",
"body": ["extends ./layout.spug", "", "block content", " ${0}"],
"description": "Extend a layout and fill the content block"
},
"Render slot": {
"prefix": "render",
"body": ["render ${1:content}", " ${0}"],
"description": "Pass a slot into a component"
},
"Frontmatter": {
"prefix": "fm",
"body": ["---", "${0}", "---"],
"description": "Front matter block with TypeScript imports"
},
"Escape expression": {
"prefix": "expr",
"body": ["#{${1:expression}}"],
"description": "Inline interpolated expression"
},
"Raw expression": {
"prefix": "raw",
"body": ["!{${1:expression}}"],
"description": "Inline raw unescaped expression"
},
"Iterate": {
"prefix": "each",
"body": ["each ${1:item} in ${2:items}", " ${0}"],
"description": "Iterate over a list"
},
"Condition": {
"prefix": "if",
"body": ["if ${1:condition}", " ${0}"],
"description": "Conditional block"
},
"Iso if-choice": {
"prefix": "unless",
"body": ["unless ${1:condition}", " ${0}"],
"description": "Inverse conditional block"
},
"Configuration block": {
"prefix": "config",
"body": ["$$$", " ${1:block}", "notes", " ${0}"],
"description": "Template test configuration and notes"
}
}