Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Prettier from using the old self closing tag syntax

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" />
like image 671
Leji Kedus -_- Avatar asked Nov 30 '25 11:11

Leji Kedus -_-


1 Answers

It can't be changed because of a Prettier philosophy, see: https://github.com/prettier/prettier/issues/5641

but you can change formatting of HTML files from Prettier to VS Code's formatter by adding in settings:

"[html]": {
  "editor.defaultFormatter": "vscode.html-language-features"
},

like in this answer: https://stackoverflow.com/a/66646608/3248254

like image 95
zdolny Avatar answered Dec 02 '25 00:12

zdolny



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!