-
Notifications
You must be signed in to change notification settings - Fork 1
/
uno.config.ts
69 lines (69 loc) · 1.97 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
import {
presetAttributify,
presetIcons,
presetUno,
transformerDirectives,
transformerVariantGroup,
defineConfig,
} from "unocss";
import { rules, shortcuts } from "./unocss/configs";
import { iconList, hoverIconList } from "./src/utils/inlineClasses";
export default defineConfig({
rules,
shortcuts,
presets: [
presetUno(),
presetAttributify(),
presetIcons({
// 用于按需加载,参考:https://unocss.dev/presets/icons#bundler
collections: {
carbon: () =>
import("@iconify-json/carbon/icons.json", {
assert: { type: "json" },
}).then((i) => i.default),
mdi: () =>
import("@iconify-json/mdi/icons.json", {
assert: { type: "json" },
}).then((i) => i.default),
ep: () =>
import("@iconify-json/ep/icons.json", {
assert: { type: "json" },
}).then((i) => i.default),
},
customizations: {
iconCustomizer(collection, icon, props) {
props.width = "1em";
props.height = "1em";
},
// customize(props) { // does not work
// props.width = '5.2em'
// props.height = '2em'
// return props
// }
},
}),
],
transformers: [transformerDirectives(), transformerVariantGroup()],
content: {
inline: [
// for icons
() => {
const hoverIconStr = hoverIconList
.map((item) => `${item} group-hover:${item} [&.is-active_i]:${item}`)
.join(" ");
const iconStr = iconList.join(" ");
return hoverIconStr + " " + iconStr;
},
],
pipeline: {
include: [
// 我把md移除了
/\.(vue|svelte|[jt]sx|astro|elm|php|phtml|html)($|\?)/,
// 这里只写我需要的,当然你也可以定制,参考:https://unocss.dev/guide/extracting#extracting-from-build-tools-pipeline
// "src/router/index.ts",
],
// exclude files
// exclude: []
},
},
});