utils.scss
1.37 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
scss 工具类添加
margin padding 10 20 30 40 px
demo:
.m-1 {
margin: 10px !important;
}
.ml-1 {
margin-left: 10px !important;
}
*/
$spacerscom: (
1:10px,
2:20px,
3:30px,
4:40px
) !default;
$utils:() !default;
$utils: map-merge($map1: (
m:(
property:margin,
values:$spacerscom
),
// mx:(
// property:margin-left margin-right,
// values:$spacerscom
// ),
ml:(
property:margin-left,
values:$spacerscom
),
mr:(
property:margin-right,
values:$spacerscom
),
mt:(
property:margin-top,
values:$spacerscom
),
mb:(
property:margin-bottom,
values:$spacerscom
),
p:(
property:padding,
values:$spacerscom
),
// px:(
// property:padding-left padding-right,
// values:$spacerscom
// ),
pl:(
property:padding-left,
values:$spacerscom
),
pr:(
property:padding-right,
values:$spacerscom
),
pt:(
property:padding-top,
values:$spacerscom
),
pb:(
property:padding-bottom,
values:$spacerscom
)
), $map2: $utils);
@each $key, $value in $utils {
// @debug $key;
$values:map-get($map: $value, $key: values);
@each $sub-key,$sub-val in $values {
$properties:map-get($map: $value, $key:property );
.#{$key}-#{$sub-key}{
@each $property in $properties {
#{$property}:$sub-val !important;
}
}
}
};