forked from BewlyBewly/BewlyBewly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unocss.config.ts
46 lines (42 loc) · 1.06 KB
/
unocss.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
import { presetAttributify, presetIcons, presetTypography, presetUno, transformerDirectives } from 'unocss'
import { defineConfig } from 'unocss/vite'
const remRE = /(-?[.\d]+)rem/g
export default defineConfig({
content: {
pipeline: {
include: [
'**/*.{js,ts}',
/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/,
],
},
},
presets: [
presetUno(),
presetAttributify(),
presetIcons({
extraProperties: {
'display': 'inline-block',
'vertical-align': 'middle',
'width': '1.2em',
'height': '1.2em',
},
}),
presetTypography(),
{
name: 'text-size-transformer',
postprocess: (util) => {
util.entries.forEach((i) => {
const value = i[1]
if (typeof value === 'string' && remRE.test(value)) {
i[1] = value.replace(remRE, (_, num: number) => {
return `calc(var(--bew-base-font-size) * ${num})`
})
}
})
},
},
],
transformers: [
transformerDirectives(),
],
})