Lightning's property-reordering behavior during minification can result in shorthand properties being moved after a lower-level setting, causing it to be reset to its default value.
In particular, I've encountered it in this situation (playground):
Original CSS
p{
font: 12px serif;
font-variant-numeric: oldstyle-nums;
}
Minified
p{font-variant-numeric:oldstyle-nums;font:12px serif}
The font shorthand property resets all the font-variant-* settings to their default, despite the clear intent of the original CSS to refine font settings after selecting the family and size.
Workaround
Adding !important to the font-variant-numeric property seems to have the side effect of reordering it to the end of the block rather than the beginning (playground), which solves the immediate rule-override issue but has the knock-on effect of interfering with the normal cascade for the variant setting. So it's not a fully satisfactory ‘solution’ to the problem.
Proposed Solutions
Reordering should either be something that can be optionally disabled, or the reordering logic should consider which shorthand properties override others and preserve their relative ordering in those cases. Perhaps this latter logic already exists and the font-variant-numeric edge case simply needs to be incorporated?
See Also
#231
#276
Lightning's property-reordering behavior during minification can result in shorthand properties being moved after a lower-level setting, causing it to be reset to its default value.
In particular, I've encountered it in this situation (playground):
Original CSS
Minified
The
fontshorthand property resets all thefont-variant-*settings to their default, despite the clear intent of the original CSS to refine font settings after selecting the family and size.Workaround
Adding
!importantto thefont-variant-numericproperty seems to have the side effect of reordering it to the end of the block rather than the beginning (playground), which solves the immediate rule-override issue but has the knock-on effect of interfering with the normal cascade for the variant setting. So it's not a fully satisfactory ‘solution’ to the problem.Proposed Solutions
Reordering should either be something that can be optionally disabled, or the reordering logic should consider which shorthand properties override others and preserve their relative ordering in those cases. Perhaps this latter logic already exists and the
font-variant-numericedge case simply needs to be incorporated?See Also
#231
#276