nunjucks-template
This is the Nunjucks-supporting extension for vscode with complete features.
feature
- nunjucks template syntax
- nunjucks formatter with prettydiff2
- yaml syntax
configurations
- By default, detects .nj, .njk files automatically.
- Additionally, use
files.associations
extension's own configurations
"nunjucksTemplate.preserveEmptyLine": 3
(suggested at issue PR #30 by @sdegutis)
other configurations
"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
"vsicons.associations.files": [
{ "icon": "nunjucks", "extensions": ["njk"], "format": "svg" }
],
"material-icon-theme.files.associations": {
"*.html": "nunjucks"
},
snippets
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 %} |
links
| |