Nunjucks template syntax definition specifically for Microsoft Visual Studio Code.
>ext install extension nunjucks
.nunjucks, .nunjs, .nj, .njk, .html, .htm, .template, .tmpl, .tpl
Although you are free to use any file extension you wish for your Nunjucks template files, the Nunjucks community has adopted .njk
To install the Nunjucks extension directly from Visual Studio Code you need to proceed with theese four simple steps:
- Go to View > Command Palette (Mac OSX:
cmd+shift+P
, Windows:ctrl+shift+P
) - Run the following command in the Command Palette field:
>ext install extension
and hit enter. - Then type
nunjucks
and hit enter. - After instalation is complete restart the Code app and you are all set up for start writing Nunjucks templates in Visual Studio Code.
To install Nunjucks manually for Visual Studio Code you need to proceed with theese five steps:
- Download this vscode-nunjucks repo from GitHub
- Navigate to the
<user home>/.vscode/extensions
directory on your computer. - Create a new folder and name it
nunjucks
- Copy all content of this repository into the
<user home>/.vscode/extensions/nunjucks
directory. - Restart the Code app and you are all set up for start writing Nunjucks templates in Code.
- This folder contains all of the files necessary for the vscode-nunjucks extension
package.json
- this is the manifest file in which the language support is declared and the location of the grammar file that has been copied into the extension is defined.syntaxes/nunjucks.tmLanguage
- this is the Text mate grammar file that is used for tokenizationnunjucks.configuration.json
- this the language configuration, defining the tokens that are used for comments and brackets.
This extension is based on the Sublime-nunjucks language file.