mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
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)($|\?)/,
|
|
],
|
|
},
|
|
},
|
|
blocklist: [
|
|
'ps',
|
|
'container',
|
|
],
|
|
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(),
|
|
],
|
|
})
|