I want to use prettier for formatting my ejs files by adding custom rules.
Right now I am using files associations of html for ejs files.
I have added the following code in the settings.json file: "files.associations": { "*.ejs": "html" },
For those on Windows, click “Control + Shift + P.” Search “Format” in the search bar, then pick “Format Document.” Select your preferred format from the available options and click on “Configure.” Click on “Prettier – Code Formatter” to format the code.
Command+Shift+P to open it. It will show search bar with right arrow >, just start typing Format Document With, and you will come up with results as below. Select Format Document With and again you will be asked for few options. Select Prettier — Code Formatter and your file will be formatted.
Unfortunately Prettier does not currently support EJS. The list of supported languages are listed in their docs https://prettier.io/docs/en/index.html
However, they do support plugins so someone could add support https://prettier.io/docs/en/plugins.html
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