45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
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(),
|
|
// attributify autocomplete
|
|
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'
|
|
},
|
|
transformers: [
|
|
// 启用 @apply 功能
|
|
transformerDirectives({
|
|
enforce: 'pre'
|
|
}),
|
|
// https://unocss.dev/transformers/variant-group
|
|
// 启用 () 分组功能
|
|
transformerVariantGroup(),
|
|
// https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerAttributify
|
|
transformerAttributify(),
|
|
// https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerClass
|
|
transformerClass()
|
|
]
|
|
})
|