From 37f58a9184f1956ceb1388944e3a52ac13c350de Mon Sep 17 00:00:00 2001 From: sibbng Date: Sat, 22 Apr 2023 13:07:56 +0300 Subject: [PATCH] fix(preset-attributify): remove ternary handling (#2529) --- packages/preset-attributify/src/extractor.ts | 4 +--- test/cases/preset-attributify/case-1/input.html | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/preset-attributify/src/extractor.ts b/packages/preset-attributify/src/extractor.ts index e0f39b3684..b76d34be28 100644 --- a/packages/preset-attributify/src/extractor.ts +++ b/packages/preset-attributify/src/extractor.ts @@ -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}"]`) } diff --git a/test/cases/preset-attributify/case-1/input.html b/test/cases/preset-attributify/case-1/input.html index 4725e373ea..ae3bc15705 100644 --- a/test/cases/preset-attributify/case-1/input.html +++ b/test/cases/preset-attributify/case-1/input.html @@ -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"