This is the Nunjucks-supporting extension for vscode with complete features.
- nunjucks template syntax
- nunjucks formatter with prettydiff2
- yaml syntax
- By default, detects .nj, .njk files automatically.
- Additionally, use
files.associations
"nunjucksTemplate.preserveEmptyLine": 3
(suggested at issue PR #30 by @sdegutis)
"files.associations": {
"*.html": "njk"
},
- For vscode embedded emmet, notify that
njk
is html file type
"emmet.includeLanguages": {
"njk": "html"
},
- max line length follows standard vscode html.format.wrapLineLength
"html.format.wrapLineLength": 120
- for vscode-icons (issue #6)
"vsicons.associations.files": [
{ "icon": "nunjucks", "extensions": ["njk"], "format": "svg" }
],
- for Material Icon Theme by Heitor Augusto
"material-icon-theme.files.associations": {
"*.html": "nunjucks"
},
Trigger | Snippet |
---|---|
n-extends | {% extends '${name}' %} |
n-block | {% block ${name} %}{% endblock %} |
n-if | {% if condition %}{% endif %} |
n-for | {% for ${condition} %}{% endfor %} |
n-macro | {% macro ${name}() %}{% endmacro %} |