You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I need to iterate recursively to create few combinations, but problem is length is always zero, length works correctly for simple values, but not for property groups.
The text was updated successfully, but these errors were encountered:
The length function in Less is designed to work with lists that are either comma or space-separated, and it returns the number of top-level elements in such lists. However, when it comes to property groups, the length function treats them as a single entity, which is why you are seeing a length of 1 instead of the expected 2.
In your example, the property groups @a and @b are being treated as single elements, hence the length function returns 1. This behavior is consistent with how Less handles complex data types like property groups, which are not directly supported by the length function in the same way as simple lists or arrays.
To achieve the desired behavior, you might need to manually count the property groups or use a different approach to handle them, as the length function does not natively support counting individual property groups within a block.
To reproduce:
https://lesscss.org/less-preview/#eyJjb2RlIjoiI2xpYigpIHtcbiAgICAuY29sb3JzKCkge1xuICAgICAgQHByaW1hcnk6IGJsdWU7XG4gICAgICBAc2Vjb25kYXJ5OiBncmVlbjtcbiAgICB9XG4gICAgLnJ1bGVzKEBzaXplKSB7XG4gICAgICBib3JkZXI6IEBzaXplIHNvbGlkIHdoaXRlO1xuICAgIH1cbiAgfVxuICBcbiAgLmJveCB3aGVuICgjbGliLmNvbG9yc1tAcHJpbWFyeV0gPSBibHVlKSB7XG4gICAgd2lkdGg6IDEwMHB4O1xuICAgIGhlaWdodDogKCR3aWR0aCAvIDIpO1xuICB9XG4gIFxuICAuYmFyOmV4dGVuZCguYm94KSB7XG4gICAgQG1lZGlhIChtaW4td2lkdGg6IDYwMHB4KSB7XG4gICAgICB3aWR0aDogMjAwcHg7XG4gICAgICAjbGliLnJ1bGVzKDFweCk7XG4gICAgfVxuICB9IiwiYWN0aXZlVmVyc2lvbiI6IjQuMi4yIiwibWF0aCI6InBhcmVucy1kaXZpc2lvbiIsInN0cmljdFVuaXRzIjpmYWxzZX0=
Current behavior:
Output is:
Expected behavior:
Output should be,
As I need to iterate recursively to create few combinations, but problem is length is always zero, length works correctly for simple values, but not for property groups.
The text was updated successfully, but these errors were encountered: