LiveStyle.ShorthandBehavior.AcceptShorthands (LiveStyle v0.16.3)

Copy Markdown View Source

Keeps shorthand properties intact while tracking related longhands for merging.

This is the default behavior. Shorthand properties are preserved, and related longhands are considered during expansion so later declarations can merge with deterministic cascade behavior.

How It Works

When you use a shorthand like margin: "10px", this behavior:

  1. Expands the shorthand through the same data used by the merger
  2. Keeps only the emitted shorthand declaration after filtering internal nil resets

This ensures that later longhands properly override earlier shorthands through CSS cascade, while keeping the output minimal.

Example

iex> AcceptShorthands.expand_declaration("margin", "10px")
[{"margin", "10px"}]

Data-Driven Expansions

Expansion mappings are loaded at compile time from data/keep_shorthands_expansions.txt. This data defines which properties are related to each shorthand and need nil resets for cascade control.