Skip to content

Commit 492442a

Browse files
fix: 🐛 splitVariantGroups does not handle all edge-cases
1 parent e96e8e5 commit 492442a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,11 @@ const styles: {
4747
}
4848

4949
function splitVariantGroups(content: string) {
50-
return content.replace(
51-
/([\w!][\w/:-]*?):\(([\s\w/-]*)\)/g,
52-
(_, groupOne: string, groupTwo: string) =>
53-
groupTwo
54-
.split(/\s/g)
55-
.map((cssClass) => `${groupOne}:${cssClass}`)
56-
.join(' ')
50+
return content.replace(/(\w+):\(([\s\w/<:!-]+)\)/g, (_, groupOne: string, groupTwo: string) =>
51+
groupTwo
52+
.split(/\s/g)
53+
.map((cssClass) => `${groupOne}:${cssClass}`)
54+
.join(' ')
5755
)
5856
}
5957

@@ -123,6 +121,7 @@ function extractStyles(): PreprocessorGroup {
123121
return {
124122
async markup({ content, filename }): Promise<Processed> {
125123
if (!filename) return { code: content }
124+
content = splitVariantGroups(content)
126125
if (initialFileName.length === 0) initialFileName = filename
127126
content = addStyleTag(content)
128127
content = content.replace(/global:/gi, '')

0 commit comments

Comments
 (0)