mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-28 08:06:16 +00:00
fix: find class lists nested in template literals
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7d7a67d492
commit
a5e8ea6aa8
@@ -274,9 +274,10 @@ function collectTailwindCandidates(dirs: string[]): string[] {
|
||||
};
|
||||
// Class lists live in string literals, whose content is split on whitespace
|
||||
// only, so arbitrary values keep their quotes, `=` and `>`
|
||||
// (`data-[state=open]:…`, `content-['x']`, `[&>svg]:hidden`).
|
||||
for (const m of text.matchAll(/"([^"\n]*)"|'([^'\n]*)'|`([^`]*)`/g)) {
|
||||
(m[1] ?? m[2] ?? m[3]).split(/\s+/).forEach(add);
|
||||
// (`data-[state=open]:…`, `content-['x']`, `[&>svg]:hidden`). Each quote kind is
|
||||
// matched on its own so a `class="…"` inside a template literal is still found.
|
||||
for (const re of [/"([^"\n]*)"/g, /'([^'\n]*)'/g, /`([^`]*)`/g]) {
|
||||
for (const m of text.matchAll(re)) m[1].split(/\s+/).forEach(add);
|
||||
}
|
||||
// Classes outside literals: Svelte directives, markup.
|
||||
text.split(/[\s"'`{}<>;=]+/).forEach(add);
|
||||
|
||||
Reference in New Issue
Block a user