Conditional enum properties in layout macros
Enum properties like image-aspect-ratio only take literal values. If the value of such property depends on some conditions, the whole block has to be repeated, possibly many times, which leads to breaking the DRY principle and makes it harder to maintain the code. It could be averted if it were possible to make a more narrow conditional, something like
if (condition) {
image-aspect-ratio (1:1)
} else-if (other condition) {
image-aspect-ratio (3:4)
} else {
image-aspect-ratio (4:3)
}
or even better
image-aspect-ratio (condition ? "1:1" : other condition ? "3:4" : "4:3")
Please sign in to leave a comment.
Comments
0 comments