Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EJS Formatting in VS Code

Currently I cannot autoformat my code when I am in an EJS file, no auto-indenting works. When I change the file type on the bottom right to HTML it thinks the markup is invalid and breaks. Does anyone have suggestions?

like image 237
Cathal Avatar asked Jul 12 '17 23:07

Cathal


People also ask

What is EJS language support?

EJS is a simple templating language that lets you generate HTML markup with plain JavaScript. No religiousness about how to organize things. No reinvention of iteration and control-flow. It's just plain JavaScript.

How do I open an EJS file?

You can open EJS files with any text editor, since the files are saved in plain text format. However, you may want to use a source code editor that supports the language or allows you to install a plugin that supports the language to provide helpful coding features.


1 Answers

A suggestion is to keep HTML formater (or use .ejs like .html) and add to your settings : "html.format.unformatted": "wbr,%"

After that, the indentation is not completely functional, but is better...

like image 180
Morphine06 Avatar answered Sep 21 '22 17:09

Morphine06