Can Stylus :extend reliably preserve selector order and pseudo-classes across versions?
0 reputation · 23 Apr 2020, 07:20 UTC
Goal
We need a repeatable development environment that guarantees deterministic CSS output when using Stylus’s :extend directive. The goal is to understand how selector ordering, mixin defaults, pseudo‑classes, and media queries interact across major Stylus releases (2.7.x vs. 3.0.x).
Constraints & Uncertainty
The current documentation does not specify whether :extend merges selector lists in a stable order, or whether the order can change when multiple extensions are applied. Additionally, it is unclear if extending a selector that contains a mixin with default arguments preserves those properties, and whether pseudo‑classes defined in a separate file survive the extension. Media queries attached to selectors may also be reordered, affecting cascade priority.
Specific Questions
- Which ordering does Stylus use for selectors from extended rules when multiple :extend directives are combined across 2.7.x and 3.0.x?
- Does extending a selector that contains a mixin with default arguments preserve the mixin’s properties in both 2.7.x and 3.0.x?
- When extending a selector with pseudo‑classes defined in a different file, does Stylus retain the pseudo‑class in the compiled CSS?
- Will a media query stay attached to the extended selector or be appended after the selector list, altering cascade order?