-
Notifications
You must be signed in to change notification settings - Fork 12
/
uno.config.ts
64 lines (62 loc) · 1.29 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
58
59
60
61
62
63
64
import {
type Preset,
defineConfig,
presetUno,
presetAttributify,
presetIcons,
transformerDirectives,
transformerVariantGroup,
} from "unocss"
import { presetApplet, presetRemRpx, transformerAttributify } from "unocss-applet"
const isMp = process.env?.UNI_PLATFORM?.startsWith("mp") ?? false
const presets: Preset[] = []
if (isMp) {
/**
* 小程序端使用presetApplet
*/
presets.push(presetApplet(), presetRemRpx())
} else {
presets.push(presetUno(), presetAttributify())
}
export default defineConfig({
presets: [
...presets,
presetIcons({
scale: 1.2,
warn: true,
extraProperties: {
display: "inline-block",
"vertical-align": "middle",
},
}),
],
/**
* unocss类名缩写
*/
shortcuts: [
/**
* 水平居中
*/
["flex-center", "flex justify-center items-center"],
/**
* 图片容器
*/
["img-container", "relative w-full h-0 pb-[100%] overflow-hidden"],
/**
* 标题
*/
["heading", "text-3xl font-bold mb-4"],
/**
* 卡片通用
*/
["card", "rounded-lg shadow-md bg-white p-4 m-2"],
],
transformers: [
transformerDirectives(),
transformerVariantGroup(),
transformerAttributify({
prefixedOnly: true,
prefix: "u",
}),
],
})