When we’re working with Eleventy there are some new file types that VS Code will not handle as you expect. Follow these steps to set up VS Code to work with them.
Nunjucks
This is the templating language we will use (11ty actually lets you use a number of them). Install the Nunjucks extension to show syntax highlighting on your files.
- Click Extensions icon
- Type in Nunjucks
- Select the extension that just says Nunjucks
Extend Emmet
This will allow you to use emmet in your Markdown and Nunjucks files.
- Click on Manage Icon
- Click Settings
- Type Emmet where it says “Search Settings”
- Scroll down to Emmet: Include Languages
- Click the Add Item button
- type nunjucks in the item and html in the value
- click OK
- Repeat this for the following item:value pairs
- njk:html
- markdown:html
It should look something like this
This is a visual way to change your settings.json file in VS Code. You can also go in and just add JavaScript. See this tutorial from Stephanie Eckles to see the type of code you would write.
2 comments