Octavian Niculescu
Octavian Niculescu

Reputation: 1327

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?

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...)

Upvotes: 1

Views: 129

Answers (1)

Sercan
Sercan

Reputation: 5081

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

Upvotes: 1

Related Questions