Skip to content

Commit 61f6559

Browse files
committed
fix: correct style removal in prettierCode function
1 parent 169aea1 commit 61f6559

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/prettierCode.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ export async function prettierCode(code: string) {
1515
}
1616

1717
const { content } = styles[0]
18-
return code.replace(content, content.replace(/\n+/g, '\n'))
18+
return code.replace(content, removeEmptyStyle(content.replace(/\n+/g, '\n')))
19+
}
20+
21+
export function removeEmptyStyle(code: string) {
22+
return code.replace(/([\w.#:[\]="'\-\s,>~]+)\{\s*\}/g, '')
1923
}

0 commit comments

Comments
 (0)