A Developer asked on Stackoverflow platform : –
So I recently installed prettier and whenever I save my file it adds the forwards slash in a self-closing tag. I was wondering how to stop it from doing this?
Here is what I mean : –
<!-- Instead of this ↓ --> <input type="text"> <!-- It does this ↓ --> <input type="text" />
The solution to this problem is simple:
First of all, we can’t change it directly because of Prettier philosophy, rather can change formatting of HTML files from Prettier to VS Code’s formatter by adding in settings:
"[html]": { "editor.defaultFormatter": "vscode.html-language-features" },
Resources
- Prettier VS Code Default Formatter
- Prettier Always Breaking The End Angle Bracket
- How to Stop Prettier From Using the Old Self Closing Tag Syntax
Add comment