Skip to content
This repository was archived by the owner on Aug 3, 2022. It is now read-only.

Commit 7bc830b

Browse files
authored
Merge pull request #141 from upfluence/pn/fix-spacing-vars
Use calc to compute spacing variables & their utility classes
2 parents e8f8f13 + 7a1b2de commit 7bc830b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

less/core-v2/_variables.less

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818
--spacing-px-9: 9px;
1919
.generate-spacing-vars(60);
2020
.generate-spacing-vars(@n, @i: 0) when (@i =< @n) {
21-
--spacing-px-@{i}: @i * 1px;
21+
--spacing-px-@{i}: calc(@i * 1px);
2222
.margin {
23-
&-px-@{i} { margin: @i * 1px; }
24-
&-left-px-@{i} { margin-left: @i * 1px; }
25-
&-right-px-@{i} { margin-right: @i * 1px; }
26-
&-top-px-@{i} { margin-top: @i * 1px; }
27-
&-bottom-px-@{i} { margin-bottom: @i * 1px; }
23+
&-px-@{i} { margin: calc(@i * 1px); }
24+
&-left-px-@{i} { margin-left: calc(@i * 1px); }
25+
&-right-px-@{i} { margin-right: calc(@i * 1px); }
26+
&-top-px-@{i} { margin-top: calc(@i * 1px); }
27+
&-bottom-px-@{i} { margin-bottom: calc(@i * 1px); }
2828
}
2929
.padding {
30-
&-px-@{i} { padding: @i * 1px; }
31-
&-left-px-@{i} { padding-left: @i * 1px; }
32-
&-right-px-@{i} { padding-right: @i * 1px; }
33-
&-top-px-@{i} { padding-top: @i * 1px; }
34-
&-bottom-px-@{i} { padding-bottom: @i * 1px; }
30+
&-px-@{i} { padding: calc(@i * 1px); }
31+
&-left-px-@{i} { padding-left: calc(@i * 1px); }
32+
&-right-px-@{i} { padding-right: calc(@i * 1px); }
33+
&-top-px-@{i} { padding-top: calc(@i * 1px); }
34+
&-bottom-px-@{i} { padding-bottom: calc(@i * 1px); }
3535
}
3636

3737
.generate-spacing-vars(@n, (@i + 6));

0 commit comments

Comments
 (0)