Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Class/id/elements shortcut in non-HTML files

In HTML files, if I write for example:

span.my-first-span

and press enter, VS Code will automatically create a span with a class of my-first-span, like this:

<span class="my-first-span"></span>

how can I make it do the same on other files, such as .js, .jsx, etc?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I tried searching for it online, but I didn’t find anything (I don’t know if my search was the best, I don’t really know how I should explain what I want…)

>Solution :

Add the following fields to your settings.json file in Visual Studio Code:

"emmet.syntaxProfiles": {
    "javascript": "jsx"
},
"emmet.triggerExpansionOnTab": true,
"emmet.includeLanguages": {
    "javascript": "javascriptreact"
}

The Emmet plugin must be installed for it to work.

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading