Skip to content

Commit

Permalink
fix(compile-class): fix conflicting with variant-group
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 12, 2022
1 parent a9412f2 commit 231bfa6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/transformer-compile-class/src/index.ts
@@ -1,5 +1,5 @@
import type { SourceCodeTransformer } from '@unocss/core'
import { escapeRegExp } from '@unocss/core'
import { escapeRegExp, expandVariantGroup } from '@unocss/core'

export interface CompileClassOptions {
/**
Expand Down Expand Up @@ -43,14 +43,14 @@ export default function transformerCompileClass(options: CompileClassOptions = {

return {
name: 'compile-class',
enforce: 'pre',
enforce: 'post',
async transform(s, _, { uno }) {
const matches = [...s.original.matchAll(regex)]
if (!matches.length)
return

for (const match of matches) {
let body = match[2].trim()
let body = expandVariantGroup(match[2].trim())
const start = match.index!
const replacements = []
if (keepUnknown) {
Expand Down
2 changes: 1 addition & 1 deletion playground/unocss.config.ts
Expand Up @@ -21,8 +21,8 @@ export default defineConfig({
presetIcons(),
],
transformers: [
transformerCompileClass(),
transformerVariantGroup(),
transformerDirectives(),
transformerCompileClass(),
],
})

0 comments on commit 231bfa6

Please sign in to comment.