Visual Studio Code removing ending slash from HTML tags

  Uncategorised

I have an odd environment in which when we go to production we need HTML tags to have no closing slash at the end. But Visual Studion and Atom both remove unnecessary closing slashes on save. For example,

<img src="..." />

becomes

<img src="..." >

after saving.

How do I remove this odd (and I’m sure in most cases convenient) feature? In Visual Studio settings I have tried disabling "HTML: Auto closing tags". I uninstalled Prettier and have no other code formatters.

My settings.json:

{
"editor.minimap.enabled": false,
"[javascript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
},
"atomKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true,
"html.autoClosingTags": false,
"editor.codeActionsOnSave": null,
"prettier.enable": false,
"html.format.enable": false
}

Source: Visual Studio Questions

LEAVE A COMMENT