Skip to content

Commit

Permalink
fix(preset-attributify): remove ternary handling (#2529)
Browse files Browse the repository at this point in the history
  • Loading branch information
sibbng committed Apr 22, 2023
1 parent 224f90f commit 37f58a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions packages/preset-attributify/src/extractor.ts
Expand Up @@ -55,9 +55,7 @@ export function extractorAttributify(options?: AttributifyOptions): Extractor {
if (options?.prefixedOnly && options.prefix && !name.startsWith(options.prefix))
return []

const extractTernary = Array.from(content.matchAll(/(?:[\?:].*?)(["'])([^\1]*?)\1/gms))
.map(([,,v]) => v.split(splitterRE)).flat()
return (extractTernary.length ? extractTernary : content.split(splitterRE))
return content.split(splitterRE)
.filter(v => Boolean(v) && v !== ':')
.map(v => `[${name}~="${v}"]`)
}
Expand Down
2 changes: 1 addition & 1 deletion test/cases/preset-attributify/case-1/input.html
Expand Up @@ -12,7 +12,7 @@
p="t-2"
pt="2"
border="rounded-xl x-1 x-style-dashed"
:font="foo > bar ? 'mono' : 'sans'"
font="mono sans"
v-bind:p="y-2 x-4"
border="2 rounded blue-200"
un-children="m-auto"
Expand Down

0 comments on commit 37f58a9

Please sign in to comment.