Skip to content

Commit

Permalink
perf(core): improve applyVariants method speed (#1790)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyYolkin committed Oct 22, 2022
1 parent bd0286d commit b546af5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/core/src/generator/index.ts
Expand Up @@ -336,10 +336,9 @@ export class UnoGenerator {
}

private applyVariants(parsed: ParsedUtil, variantHandlers = parsed[4], raw = parsed[1]): UtilObject {
const handler = [...variantHandlers]
const handler = variantHandlers.slice()
.sort((a, b) => (a.order || 0) - (b.order || 0))
.reverse()
.reduce(
.reduceRight(
(previous, v) =>
(input: VariantHandlerContext) => {
const entries = v.body?.(input.entries) || input.entries
Expand Down

0 comments on commit b546af5

Please sign in to comment.