Search code examples
htmlcssvisual-studio-codesassvscode-snippets

Using $ in vscode snippets


I am trying to create a snippet which includes a $ sign, but in output vscode is skipping the $ sign and making the text selected.

"Color 1": {
        "prefix": "c1",
        "body": [
            "color: $c1;"
        ]
    }

Output

color: c1;

I have also tried using \ and ''. Can anyone please guide.


Solution

  • You can escape $ sign in snippets with double backslash \\ like this:

    "Color 1": {
        "prefix": "c1",
        "body": [
                "color: \\$c1;"
        ]
    }