loop.less
1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.loop (@style-name, @tag-name, @i,@base-size, @max:10,@xy:none) when (@i <= @max) {
@next: @i+1;
.fn() when (@xy =none) {
@size: @base-size * @i;
.@{style-name}-@{i} {
@{tag-name}: ~'@{size}px ';
}
.loop(@style-name, @tag-name, @next, @base-size, @max, @xy);
}
.fn() when (@xy =x) {
@size: @base-size * @i;
@tnl: ~'@{tag-name}-left';
@tnr: ~'@{tag-name}-right';
.@{style-name}-@{i} {
@{tnl}: ~'@{size}px';
@{tnr}: ~'@{size}px';
}
.loop(@style-name, @tag-name, @next, @base-size, @max, @xy);
}
.fn() when (@xy =y) {
@size: @base-size * @i;
@tnt: ~'@{tag-name}-top';
@tnb: ~'@{tag-name}-bottom';
.@{style-name}-@{i} {
@{tnt}: ~'@{size}px';
@{tnb}: ~'@{size}px';
}
.loop(@style-name, @tag-name, @next, @base-size, @max, @xy);
}
.fn() when (@xy =auto) {
@tnt: ~'@{tag-name}-top';
@tnb: ~'@{tag-name}-bottom';
@tnl: ~'@{tag-name}-left';
@tnr: ~'@{tag-name}-right';
.@{style-name} {
@{tnl}: ~'auto';
@{tnr}: ~'auto';
@{tnt}: ~'auto';
@{tnb}: ~'auto';
}
}
.fn() when (@xy =autoX) {
@tnl: ~'@{tag-name}-left';
@tnr: ~'@{tag-name}-right';
.@{style-name} {
@{tnl}: ~'auto';
@{tnr}: ~'auto';
}
}
.fn() when (@xy =autoY) {
@tnt: ~'@{tag-name}-top';
@tnb: ~'@{tag-name}-bottom';
.@{style-name} {
@{tnt}: ~'auto';
@{tnb}: ~'auto';
}
}
.fn();
}