From 104a3f6b0cd8e6eba1c9195fa832ebe8c16eaa7a Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 29 Aug 2022 11:25:08 +0800 Subject: [PATCH] fix: when`{}` in the tag --- packages/transformer-attributify/src/index.ts | 3 ++- playground/src/pages/index/index.vue | 11 +++++++---- test/fixtures/attributify.vue | 4 ++++ test/transformer-attributify.test.ts | 4 ++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/transformer-attributify/src/index.ts b/packages/transformer-attributify/src/index.ts index 381f865..adf1b00 100644 --- a/packages/transformer-attributify/src/index.ts +++ b/packages/transformer-attributify/src/index.ts @@ -9,7 +9,8 @@ const strippedPrefixes = [ ] const splitterRE = /[\s'"`;]+/g -const elementRE = /<\w(?=.*>)[\w:\.$-]*\s((?:['"`\{].*?['"`\}]|.*?)*?)>/gs +// const elementRE = /<\w(?=.*>)[\w:\.$-]*\s((?:['"`\{].*?['"`\}]|.*?)*?)>/gs +const elementRE = /<\w(?=.*>)[\w:\.$-]*\s(((\&>)|.*?)*?)\/?>/gs const valuedAttributeRE = /([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-]+)(?:={?(["'])([^\2]*?)\2}?)?/g export const defaultIgnoreAttributes = ['placeholder', 'setup', 'lang', 'scoped'] diff --git a/playground/src/pages/index/index.vue b/playground/src/pages/index/index.vue index 7da86d1..9cce6b9 100644 --- a/playground/src/pages/index/index.vue +++ b/playground/src/pages/index/index.vue @@ -8,19 +8,22 @@ const bool = true