/*
|
* @Author : yuan
|
* @Date : 2025-09-28 09:31:16
|
* @LastEditors : yuan
|
* @LastEditTime : 2025-09-28 09:38:38
|
* @FilePath : \uno.config.js
|
* @Description :
|
* Copyright 2025 OBKoro1, All Rights Reserved.
|
* 2025-09-28 09:31:16
|
*/
|
import {
|
defineConfig,
|
presetIcons,
|
transformerDirectives,
|
transformerVariantGroup
|
} from "unocss"
|
import { presetWeapp } from "unocss-preset-weapp"
|
import {
|
extractorAttributify,
|
transformerClass
|
} from "unocss-preset-weapp/transformer"
|
|
const {
|
presetWeappAttributify,
|
transformerAttributify
|
} = extractorAttributify()
|
|
export default defineConfig({
|
presets: [
|
// https://github.com/MellowCo/unocss-preset-weapp
|
presetWeapp(),
|
presetWeappAttributify(),
|
// https://unocss.dev/presets/icons
|
presetIcons({
|
scale: 1.2,
|
warn: true,
|
extraProperties: {
|
display: "inline-block",
|
"vertical-align": "middle"
|
}
|
})
|
],
|
/**
|
* 自定义快捷语句
|
* @see https://github.com/unocss/unocss#shortcuts
|
*/
|
shortcuts: {
|
"border-base": "border border-gray-500_10",
|
center: "flex justify-center items-center"
|
},
|
theme: {
|
colors: {
|
// 主题颜色
|
primary: "var(--theme-primary)",
|
success: "var(--theme-success)",
|
warning: "var(--theme-warning)",
|
error: "var(--theme-error)",
|
// 文字颜色
|
"text-main": "var(--theme-main-color)",
|
"text-content": "var(--theme-content-color)",
|
"text-tips": "var(--theme-tips-color)",
|
"text-light": "var(--theme-light-color)",
|
"text-disabled": "var(--theme-disabled-color)",
|
// 背景颜色
|
"bg-main": "var(--theme-bg-color)",
|
"bg-secondary": "var(--theme-bg-color-secondary)",
|
// 边框颜色
|
"border-main": "var(--theme-border-color)"
|
}
|
},
|
transformers: [
|
// 启用 @apply 功能
|
transformerDirectives({
|
enforce: "pre"
|
}),
|
// https://unocss.dev/transformers/variant-group
|
// 启用 () 分组功能
|
transformerVariantGroup(),
|
transformerAttributify(),
|
// https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerClass
|
transformerClass()
|
]
|
})
|