0

I want my prefix "ffz15" turns into "font-size: var(--fz15)". So, when I have typed "ffz", everything that goes after this prefix should come as variable and inserts in snippets body.

It should be something like this (pseudocode):

"font-size variable": {
    "scope": "css, scss",
    "prefix": "fzz{value-of-font-size}",
    "body": [
        "font-size: var(--fz{value-of-font-size}px)",
    ],
},

I think it can be made quite simple, but I cannot find any information about that. Thank you in advance for your help.

rozhnovds
  • 1
  • 1

1 Answers1

0

I don't think you can use part of the prefix as a variable in the snippet. Can you just do this instead? Use fzz as prefix, then it inserts the snippet, and puts you at the place where you just type the font size:

"font-size variable": {
        "scope": "css, scss",
        "prefix": "fzz",
        "body": [
            "var(--fz$0)",
        ],
    },
Bill Morgan
  • 538
  • 2
  • 14
  • Thanks for your answer, @Bill Morgan. I know about this feature and of course i can use it. But in my case I would know is it possible to convert ffz{font-size} in font-size: var(--fz{font-size} like it emmet does in natural way ( fz{font-size} --> font-size: {font-size}px )? – rozhnovds Jul 09 '22 at 14:09
  • The only way I can think of is to have a snippet for every font size. – Bill Morgan Jul 09 '22 at 14:11
  • I thought about this) It is a way to deal with my "problem" but with a bunch of similar code. – rozhnovds Jul 09 '22 at 14:16
  • you might want to try the [HyperSnips](https://marketplace.visualstudio.com/items?itemName=draivin.hsnips) extension that is described in this answer: https://stackoverflow.com/a/54390612/1046249 – Bill Morgan Jul 09 '22 at 14:27