-
Notifications
You must be signed in to change notification settings - Fork 249
/
Copy path_functions.styl
42 lines (31 loc) · 951 Bytes
/
_functions.styl
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
// Get percentage from a given ratio.
_get-span(ratio = 1)
return ratio * 100
// Work out the column widths based on the ratio and gutter sizes.
_get-column(ratios = 1, gutter = $jeet.gutter)
ratios = _reverse(ratios) unless $jeet.parent-first is true
width = 100
for ratio in ratios
gutter = gutter / width * 100
width = 100 * ratio - gutter + ratio * gutter
return width gutter
// Get the set layout direction for the project.
_get-layout-direction()
$jeet.layout-direction == RTL ? result = right : result = left
return result
// Replace a specified list value with a new value.
_replace-nth(list, index, value)
result = ()
index = length(list) + index if index < 0
for i in (0..(length(list) - 1))
if i == index
append(result, value)
else
append(result, list[i])
return result
// Reverse a list.
_reverse(list)
result = ()
for item in list
prepend(result, item)
return result