class

Hwaro::Assets::Sass::Expr::Evaluator

Inherits Reference < Object

Constants

CALC_FALLBACK_FNS = ["min", "max", "clamp"] of ::String

min()/max()/clamp() fall back to their CSS text on a unit clash.

MATH_CSS_FNS = ["min", "max", "clamp", "round", "abs"] of ::String

The calc-like members of SHADOWED_CSS_FNS: their / is math.

SHADOWED_CSS_FNS = ["rgb", "rgba", "hsl", "hsla", "hwb", "min", "max", "clamp", "round", "abs", "invert", "grayscale", "greyscale", "opacity", "saturate"] of ::String

Built-ins that shadow real CSS functions. Their argument lists may be plain CSS (rgb(255 0 0 / 0.5), min(10px, 5%/2)), so a / inside must stay literal — forcing division there would corrupt the reconstructed passthrough.

Constructors

new(host : Host, strict : Bool = false, force_div : Bool = false, coercing : Bool = false, fold_calc : Bool = true)

In lenient (value) contexts, and/or only operate on real booleans/null: unquoted CSS idents like a hypothetical Franklin and Marshall font stack must fall back to verbatim text, never evaluate to one operand. Strict contexts (@if/@while conditions) keep full Sass truthiness.

force_div starts the evaluation in a division-forcing context (variable declarations, interpolation, strict contexts): every / in the tree divides. When it starts false (declaration values), a / divides only when an operand is computed or the slash sits under other arithmetic / a Sass function call — the classic Sass division rule.

Source

Instance methods

eval(node : Node) : Value
Source