Reputation: 53
I am having the problem witj .ejs files. The synthax just doesn`t seem to work for some reason:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
SomeText
<br>
<%- body %>
<br>
</body>
</html>
I am running a small Node.js application and I set up EJS as a view engine: app.set('view engine', 'ejs')
When I hover over the <%- and %>, it says: 'Special characters must be escaped : [ > ].(spec-char-escape)'
I have installed extension called EJS Language support and the have installed ejs package: "dependencies": { "ejs": "^3.1.8" },
How to get around this error?
Upvotes: 2
Views: 688
Reputation: 53
I found the solution. I opened the setting.json file and inserted this into:
{
"files.associations": {
"*.ejs": "html"
},
"emmet.includeLanguages": {
"ejs": "html"
},
"htmlhint.options": {
"spec-char-escape": false,
"doctype-first": false
},
"html.validate.scripts": false,
}
Now the Visual Studio recognizes the EJS file and the code can run.
Upvotes: 1