I am trying to follow this tutorial and write some code in EJS in VS Code. I ran npm i express ejs
as per the video's instructions to install both Express and EJS, and no errors popped up in the console. However, in the bottom right (in the blue bar) it still says HTML, and when I click on this to change the language, EJS doesn't appear in the list.
Am I missing something here? Is there another step I was meant to follow? Any help would be greatly appreciated.
By default VSCode does not have syntax highlighting for EJS template files. You need to install a plugin like this one - EJS language support.
You also need to configure the file association for .ejs
files. In order to do so type the following command (using CTRL + SHIFT + P
) - Change language mode
and then select Configure file association for .ejs
, then select HTML
from the dropdown.
Working solution (September 2021)
And add these settings to VScode,
"files.associations": {
"*.ejs": "html"
},
"emmet.includeLanguages": {
"ejs": "html",
},
"html.format.templating": true
Have fun 😎
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With