Automatic Conflict Resolution
Maple treats the class attribute as an ordered style declaration. When two utilities write the same CSS property in the same context, the utility on the right wins and the overridden utility is removed from the element.
Why Maple Merges Classes
Utility classes are easy to compose, but equal-specificity utilities do not follow the visual order of the class string by default. The browser chooses between generated CSS rules by stylesheet order, not by the order of tokens inside the class attribute.
In Tailwind-style component code, conflicts are often handled by passing class strings through helpers such as clsx and tailwind-merge. Maple moves that responsibility into the runtime CSS engine instead. It reads the element after classes exist in the DOM, calculates what each utility will write, and normalizes the class list in place.
The Class Attribute Is the Source of Truth
Core Rule
Maple builds a conflict key from the generated CSS property plus its media-query and selector context. If a later utility targets the same key, it replaces the earlier one. If the context is different, both utilities stay.
<div class="p-4 p-8"></div>
<!-- Normalizes to class="p-8" -->
<div class="@md:p-4 @md:p-8"></div>
<!-- Normalizes to class="@md:p-8" -->
<div class="p-4 @md:p-8"></div>
<!-- Both are kept as they are in different contexts -->p-4 p-8p-8Both write padding in the base context.
@md:p-4 @md:p-8@md:p-8Both write padding in the same media context.
p-4 @md:p-8p-4 @md:p-8Base and responsive contexts are independent.
&:hover:p-4 &:hover:p-8&:hover:p-8Both write padding inside the same selector context.
Context Is Exact
&:hover:focus:p-2 and &:focus:hover:p-4 are preserved as separate contexts. Context Details
The context part of a conflict key includes media prefixes, selector prefixes, arbitrary variants, and important priority. Different contexts preserve their utilities even when the final property is the same.
p-6 p-6p-6Exact duplicates collapse to the last occurrence.
@md:p-4 @lg:p-4@md:p-4 @lg:p-4Different media contexts do not conflict.
@dark:@md:p-6 @md:@dark:p-4@md:@dark:p-4Equivalent media stacks share a context after Maple normalizes them.
^.active:p-4 ^.active:p-6^.active:p-6Parent selectors are part of the selector context.
[&:nth-child(3)]:py-0 [&:nth-child(3)]:py-4[&:nth-child(3)]:py-4Arbitrary variants merge when their selector context matches.
Property-Aware Merging
Maple does not compare class names as plain strings. It parses each utility, resolves abbreviations, understands shorthand coverage, and compares the CSS properties that would actually be emitted.
p-4 padding-6padding-6Abbreviations and original CSS property names share a conflict space.
p-4 p=10pxp=10pxToken values, arbitrary values, and literal values all target the same property.
h-[10px] h-[20px]h-[20px]Arbitrary values merge by their generated property.
--tone-factor=1 --tone-factor=2--tone-factor=2CSS variable utilities merge by variable name.
Refinements
Broad shorthands can remove earlier longhands that they fully cover, but Maple keeps later refinements when they intentionally narrow part of a shorthand. This lets you write broad defaults first and then adjust one edge, axis, or component.
mx-4 m-6m-6The later margin shorthand covers the earlier X axis.
m-6 mx-4m-6 mx-4The later X-axis utility refines the shorthand.
brt-1 br-2br-2The later border shorthand covers the top border.
br-px_solid brc-redbr-px_solid brc-redBorder color can refine a previously declared border.
brc-red br-px_solidbr-px_solidThe later border shorthand includes browser's native color definition, overriding the previous border color utility.
False Positives Are Avoided
br-px rad-px, fx-1 fxdir=row, of=hidden ofwr=anywhere, and cols-1 col-2 stay together because they target distinct behavior. Composable Properties
Some CSS features are assembled from independent components. Maple merges those utilities by component, not by the final serialized property, so compatible transform and filter utilities can live together.
tl-4 rot-45tl-4 rot-45Translate and rotate are separate transform components.
tl-4 tl-8tl-8Both utilities write the translate component.
blur-4 brightness-100blur-4 brightness-100Different filter components compose.
blur-4 blur-8blur-8Both utilities write the blur component.
Important Utilities
Important utilities participate in the same merge model, but Maple preserves CSS priority. A later important utility replaces earlier normal or important utilities for the same property. A later normal utility does not remove an earlier important utility, because both can affect the final cascade differently.
<div class="!p-3 !p-4"></div>
<!-- class="!p-4" -->
<div class="p-3 !p-4"></div>
<!-- class="!p-4" -->
<div class="!p-3 p-4"></div>
<!-- class="!p-3 p-4" --> Refinements follow the same priority rules. For example, !p-3 px-5 stays intact because the normal X-axis refinement can still contribute where it is not suppressed, while px-5 !p-3 becomes !p-3.
Aliases
Aliases are expanded before merge checks, so their members can conflict with regular utilities. The alias token remains in the class list when at least one expanded utility still contributes to the element.
<html class="--alias-space=p-4">
<div class="@space p-8"></div>
<!-- class="p-8" -->
</html>
<html class="--alias-focus-ring=olw-2px;olst=solid;olc=currentColor">
<button class="@focus-ring olw-4px"></button>
<!-- class="@focus-ring olw-4px" -->
</html> In the first example, @space expands only to p-4, so a later p-8 fully replaces it. In the second, @card also contributes bgc-white, so the alias stays even though its padding member is overridden.
Disabling Conflict Resolution
Automatic conflict resolution is enabled by default. Use nomerge only when you deliberately want Maple to leave class attributes exactly as authored. The behavior and trade-offs are covered in Configuration: Nomerge Mode.