-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
78 lines (74 loc) · 2.29 KB
/
index.js
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
const plugin = require("tailwindcss/plugin");
const percentageUtils = plugin(({e, addUtilities}) => {
const lista = [...Array(101).keys()];
const newUtilities = lista.map((x) => {
return {
[`.${e(`w-${x}/100`)}`]: {
width: `${x}%`,
},
[`.${e(`h-${x}/100`)}`]: {
height: `${x}%`,
},
[`.${e(`min-w-${x}/100`)}`]: {
"min-width": `${x}%`,
},
[`.${e(`max-w-${x}/100`)}`]: {
"max-width": `${x}%`,
},
[`.${e(`min-h-${x}/100`)}`]: {
"min-height": `${x}%`,
},
[`.${e(`max-h-${x}/100`)}`]: {
"max-height": `${x}%`,
},
[`.${e(`p-${x}/100`)}`]: {
padding: `${x}%`,
},
[`.${e(`pl-${x}/100`)}`]: {
"padding-left": `${x}%`,
},
[`.${e(`pr-${x}/100`)}`]: {
"padding-right": `${x}%`,
},
[`.${e(`pt-${x}/100`)}`]: {
"padding-top": `${x}%`,
},
[`.${e(`pb-${x}/100`)}`]: {
"padding-bottom": `${x}%`,
},
[`.${e(`m-${x}/100`)}`]: {
margin: `${x}%`,
},
[`.${e(`ml-${x}/100`)}`]: {
"margin-left": `${x}%`,
},
[`.${e(`mr-${x}/100`)}`]: {
"margin-right": `${x}%`,
},
[`.${e(`mt-${x}/100`)}`]: {
"margin-top": `${x}%`,
},
[`.${e(`mb-${x}/100`)}`]: {
"margin-bottom": `${x}%`,
},
[`.${e(`my-${x}/100`)}`]: {
"margin-top": `${x}%`,
"margin-bottom": `${x}%`,
},
[`.${e(`mx-${x}/100`)}`]: {
"margin-left": `${x}%`,
"margin-right": `${x}%`,
},
[`.${e(`py-${x}/100`)}`]: {
"padding-top": `${x}%`,
"padding-bottom": `${x}%`,
},
[`.${e(`px-${x}/100`)}`]: {
"padding-left": `${x}%`,
"padding-right": `${x}%`,
},
};
});
addUtilities(newUtilities);
});
module.exports = percentageUtils;