S
S
skuvaWeb2019-03-07 17:00:40
css
skuvaWeb, 2019-03-07 17:00:40

How to customize snippets in vsCode?

I can't figure out how to achieve the following behavior:
I want to be able to write @mw500 and the snippet will be transformed into

@media (max-width: 500px){
  
}

How to pass this "variable" to the snippet, as a number

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai, 2019-03-07
@Skofield2016

To make a snippet, go to file-settings-new snippet.
Save file. The snippet file will open, there is an example commented out.
Everything is described in detail. The name of the snippet, the short name by which it will be called, in which files it will work, the snippet body and description.
You will have such a snippet.
"@media500": {
"prefix": "@mw500",
"scope": "css",
"body": [
"@media (max-width: 500px){$1}",
],
"description": " Including @media"
},
The $ sign is where the cursor will be positioned after the snippet has expanded.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question