unocss / unocss

The instant on-demand atomic CSS engine.

Home Page:https://unocss.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`,` escape breaks svelte scoping

alexanderniebuhr opened this issue · comments

Using a class like grid-cols-[repeat(6,1fr)], unocss will escape , in the selector with \2c. This works as a style, but it will not work with svelte's check for unused styles in scope mode.
Therefore the style is removed on build time, leading to missing style.

Just using the \, to escape the comma (as seen in the example) will make the style work and svelte actually understand that the style is used.

Actual Output:
https://stackblitz.com/edit/web-platform-1asmuc?file=styles.css

Expected Output:
https://stackblitz.com/edit/web-platform-akerk4?file=styles.css

The escape function was copied from somewhere else. If you can make sure the new escape works on browsers, feel free to change the code and send a PR. Thanks.