-
Notifications
You must be signed in to change notification settings - Fork 21
/
uno.config.ts
84 lines (81 loc) · 2.13 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import {
type PresetOrFactory,
type UserConfig,
defineConfig,
presetIcons,
transformerDirectives,
transformerVariantGroup,
} from 'unocss'
import presetRemToPx from '@unocss/preset-rem-to-px'
import { isH5, isMp } from '@uni-helper/uni-env'
import { presetUni } from '@uni-helper/unocss-preset-uni'
const darkMode = isH5 ? 'class' : 'media'
const config: UserConfig = defineConfig({
content: {
pipeline: {
exclude: [
'node_modules',
'.git',
'.github',
'.husky',
'.vscode',
'build',
'dist',
'mock',
'public',
'types',
'./stats.html',
],
},
},
shortcuts: [
['btn', 'w-60 h-60 flex items-center justify-center rounded-full bg-teal-600 text-white cursor-pointer'],
['wh-full', 'w-full h-full'],
['f-c-c', 'flex justify-center items-center'],
['flex-col', 'flex flex-col'],
['absolute-lt', 'absolute left-0 top-0'],
['absolute-lb', 'absolute left-0 bottom-0'],
['absolute-rt', 'absolute right-0 top-0'],
['absolute-rb', 'absolute right-0 bottom-0'],
['absolute-center', 'absolute-lt f-c-c wh-full'],
['text-ellipsis', 'truncate'],
[
'icon-btn',
'inline-block cursor-pointer select-none opacity-75 transition duration-200 ease-in-out hover:opacity-100 hover:text-teal-600',
],
],
presets: [
presetUni({
uno: {
dark: darkMode,
variablePrefix: 'li-',
},
attributify: {
ignoreAttributes: ['block', 'fixed'],
},
remRpx: {
baseFontSize: 2,
mode: isMp ? 'rem2rpx' : 'rpx2rem',
},
}) as PresetOrFactory,
presetIcons({
scale: 1.2,
warn: true,
extraProperties: {
'display': 'inline-block',
'vertical-align': 'middle',
},
}),
// 保持h5和微信小程序转换比例一致
presetRemToPx({ baseFontSize: 2 }),
],
transformers: [
transformerDirectives(),
transformerVariantGroup(),
],
safelist: 'prose prose-sm m-auto text-left'.split(' '),
theme: {
preflightRoot: isMp ? ['page,::before,::after'] : undefined,
},
})
export default config