-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuno.config.js
64 lines (62 loc) · 1.64 KB
/
uno.config.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
import {
transformerVariantGroup,
transformerDirectives,
presetAttributify,
presetMini,
presetUno
} from 'unocss'
import { defineUsefulConfig } from 'unocss-preset-useful'
import layoutJSON from './public/config/layout.json'
const safelist = []
layoutJSON.routes.forEach((route) => {
route.panels.forEach((panel) => {
const widget = panel.widget
if (panel.class) {
safelist.push(panel.class)
}
if (widget.class) {
safelist.push(widget.class)
}
if (widget.subWidgets) {
widget.subWidgets.forEach((subWidget) => {
if (subWidget.class) {
safelist.push(subWidget.class)
}
})
}
})
})
// https://github.com/unocss/unocss#readme
export default defineUsefulConfig(
{
important: true
},
{
safelist,
presets: [
presetMini({ dark: 'class' }),
// https://unocss.dev/presets/attributify#properties-conflicts
presetAttributify({ prefix: 'un-', prefixedOnly: true }),
presetUno()
],
transformers: [transformerDirectives(), transformerVariantGroup()],
rules: [
[
/^m-(\w+)-(\w+)-(\w+)-(\w+)$/,
(match) => ({ margin: `${match[1]} ${match[2]} ${match[3]} ${match[4]}` })
],
[
/^p-(\w+)-(\w+)-(\w+)-(\w+)$/,
(match) => ({ padding: `${match[1]} ${match[2]} ${match[3]} ${match[4]}` })
]
],
shortcuts: {
'flex-ac': 'flex justify-around items-center',
'flex-bc': 'flex justify-between items-center',
'flex-cc': 'flex justify-center items-center',
'flex-sc': 'flex justify-start items-center',
'flex-ec': 'flex justify-end items-center'
},
theme: {}
}
)