lazarljubenovic/grassy

Support repeating in ASCII syntax

Opened this issue · 0 comments

Basic idea

It'd come in handy if Grassy allowed to repeat rows "forever", instead of forcing a full spec declaration. For example, a simple alternating layout such as the following will work only for 1, 2, 3 or 4 elements. The fifth element would not styled at all.

x-x x
x x-x

The grid mixin should accept a parameter $repeat, which can be set to true.

Extending the idea

However, it's not always desirable to repeat the whole layout. Consider this.

x-x-x
x x-x
x-x x

We might want to repeat the last two rows "forever". Something like $repeat-last: 2.

Thinking further

Of course, this begs for $repeat-first, or even $repeat: from 2 to 4 in cases like the following:

x-x-x
x x-x
x-x x
x-x-x

This would make sure that the first and last elements are always spanning across the whole grid, while the middle ones are alternating. However, even such a simple case would have too many edge cases to consider, which would have to be configurable in order to be sued properly:

  • What if there is only 1 element? 2?
  • How to even-out "dangling" elements?

This needs very careful consideration, so I'll open a new issue for this after the basic case is done first.