Skip to content

Commit

Permalink
feat(transformer-compile-class): add layer option (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
ARZarkesh committed Jun 19, 2022
1 parent 5bfbf81 commit 6f6e134
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/transformer-compile-class/src/index.ts
Expand Up @@ -25,6 +25,11 @@ export interface CompileClassOptions {
* @default true
*/
keepUnknown?: boolean

/**
* The layer name of generated rules
*/
layer?: string
}

export default function transformerCompileClass(options: CompileClassOptions = {}): SourceCodeTransformer {
Expand Down Expand Up @@ -59,7 +64,7 @@ export default function transformerCompileClass(options: CompileClassOptions = {
const hash = hashFn(body)
const className = `${classPrefix}${hash}`
replacements.unshift(className)
uno.config.shortcuts.push([className, body])
uno.config.shortcuts.push([className, body, { layer: options.layer }])
}
s.overwrite(start + 1, start + match[0].length - 1, replacements.join(' '))
}
Expand Down

0 comments on commit 6f6e134

Please sign in to comment.