-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathuno.config.ts
57 lines (56 loc) · 1.5 KB
/
uno.config.ts
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
// uno.config.js
import { defineConfig } from "unocss";
import transformerDirective from "@unocss/transformer-directives";
import { presetAttributify, presetUno } from "unocss";
import presetRemToPx from "@unocss/preset-rem-to-px";
export default defineConfig({
rules: [
[/^fs-(\d+)/, ([, d]) => ({ "font-size": `${d}px` })],
[
/^(w|h)(p)?-(\d+)(i)?$/,
([, wh, p, d, i]) => {
const key = wh === "w" ? "width" : "height";
const value = `${d}${p ? "%" : "px"}`;
const important = i ? "!important" : "";
return {
[key]: `${value} ${important}`,
};
},
],
[
/^b([r|t|b|l]?)-(\d+)-([a-z]+)$/,
([, p, d, c]) => {
let prop = "border";
switch (p) {
case "t":
prop += "-top";
break;
case "b":
prop += "-bottom";
break;
case "l":
prop += "-left";
break;
case "r":
prop += "-right";
break;
}
return { [prop]: `${d}px solid #${c}` };
},
],
],
shortcuts: {
"f-jc": "flex justify-center",
"f-jb": "flex justify-between",
"f-ac": "flex items-center",
"f-ac-jc": "flex items-center justify-center",
"f-ac-jb": "flex items-center justify-between",
"f-wb": "flex flex-wrap justify-between",
},
transformers: [transformerDirective() as any],
presets: [
presetAttributify(),
presetUno(),
presetRemToPx({ baseFontSize: 4 }),
],
});