headwind icon indicating copy to clipboard operation
headwind copied to clipboard

Support for Svelte files

Open michael4reynolds opened this issue 3 years ago • 3 comments

Please add support for .svelte files or enable svelte files to be handled as html files.

Thanks

michael4reynolds avatar Jun 22 '21 12:06 michael4reynolds

You're probably able to solve this by adding a classRegex option to the settings. I did this for .njk files and just inserted the same regex as is used for html files:

  "headwind.classRegex": {
    "njk": "\\bclass\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\']"
  }

schtibe avatar Sep 07 '21 12:09 schtibe

You're probably able to solve this by adding a classRegex option to the settings. I did this for .njk files and just inserted the same regex as is used for html files:

  "headwind.classRegex": {
    "njk": "\\bclass\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\']"
  }

Tried this, unfortunately doesn't appear to work with Svelte.

Settings.json:

"headwind.classRegex": {
  "svelte": "\\bclass\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\']"
}

jmroon avatar Dec 23 '21 16:12 jmroon

@jmroon Strange! I just tested it and it worked in my editor. I used a slightly different RegEx, not sure why, but does it work on your machine with this one:

    "svelte": "\\bclass\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/\\[\\]]+)[\\\"\\']"

schtibe avatar Jan 05 '22 22:01 schtibe