-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·70 lines (64 loc) · 1.88 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
const plugin = require("tailwindcss/plugin");
const padding = require("./padding.js");
const margin = require("./margin.js");
const borderRadius = require("./borderRadius.js");
const borderWidth = require("./borderWidth.js");
const defaultOptions = {
writingMode: true,
logicalMargin: true,
logicalPadding: true,
LogicalBorderWidth: true,
logicalBorderRadius: false
};
module.exports = function(userOptions) {
const options = { ...defaultOptions, ...userOptions };
return plugin(
function(props) {
const { addUtilities, variants, config } = props;
// * add Wrting Mode css Rules
if (options.writingMode) {
addUtilities(
{
".rm-h": { "writing-mode": "horizontal-tb;" },
".rm-vl": { "writing-mode": "vertical-lr;" },
".rm-vr": { "writing-mode": "vertical-rl;" }
},
variants("writingMode")
);
}
// * add Float css Rules
const floatConfig = config("corePlugins.float");
if (!(floatConfig === false)) {
addUtilities(
{
".float-start": { float: "inline-start" },
".float-end": { float: "inline-end" }
},
variants("float")
);
}
// * add Text Align css Rules
const textAlignConfig = config("corePlugins.textAlign");
if (!(textAlignConfig === false)) {
addUtilities(
{
".text-start": { "text-align": "start" },
".text-end": { "text-align": "end" }
},
variants("textAlign")
);
}
// * add Padding css Rules
padding(props, options.logicalPadding);
margin(props, options.logicalMargin);
borderWidth(props, options.LogicalBorderWidth);
borderRadius(props, options.logicalBorderRadius);
},
{
theme: {},
variants: {
writingMode: ["responsive"]
}
}
);
};