-
Notifications
You must be signed in to change notification settings - Fork 0
/
uno.config.ts
48 lines (40 loc) · 1.24 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
import type { CSSEntries } from 'unocss'
import { defineConfig, entriesToCss, presetAttributify, presetIcons, presetUno } from 'unocss'
import presetRemToPx from '@unocss/preset-rem-to-px'
import { kebabCase } from 'lodash-es'
import { iconNames } from './src/assets/icons'
import { colorCssVar, colorTheme } from './src/assets/theme'
export default defineConfig({
presets: [
presetUno(),
presetAttributify(),
presetIcons({
warn: true,
prefix: ['i-'],
extraProperties: {
display: 'inline-block',
},
}),
presetRemToPx({
baseFontSize: 4,
}),
],
shortcuts: [
{
'wh-full': 'w-full h-full',
'flex-center': 'flex justify-center items-center',
'icon-btn': 'p-6 flex-center cursor-pointer rounded-4 hover:bg-#eaf0f1',
},
[/^border-([rltb])$/, ([,c]) => `border-${c}-1 border-${c}-#efeff5 border-${c}-solid`],
],
safelist: iconNames.flatMap(icon => `i-${icon} i-${icon}?mask`.split(' ')),
theme: {
colors: colorCssVar,
},
preflights: [{
getCSS: () => {
const entriesColors: CSSEntries = Object.entries(colorTheme.common!).map(([name, value]) => [`--${kebabCase(name)}`, value])
return `:root {${entriesToCss(entriesColors)}}`
},
}],
})