代码拉取完成,页面将自动刷新
/*
* @Author : wfl
* @LastEditors : wfl
* @description :
* @updateInfo :
* @Date : 2024-03-14 11:00:23
* @LastEditTime : 2024-03-26 14:29:00
*/
import type { Theme } from 'unocss/preset-uno'
import {
defineConfig,
presetAttributify,
presetIcons,
presetTypography,
presetUno,
transformerCompileClass,
transformerDirectives,
transformerVariantGroup,
} from 'unocss'
import { entriesToCss, toArray } from '@unocss/core'
import themes from './themes'
export default defineConfig<Theme>({
content: {
pipeline: {
include: [
/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/,
'main-app/**/*.{js,ts}',
],
},
},
shortcuts: [
{
'flex-center': 'flex justify-center items-center',
'flex-col-center': 'flex flex-col justify-center items-center',
},
],
preflights: [
{
getCSS: () => {
const returnCss = []
Object.keys(themes).forEach((key) => {
const css = entriesToCss(Object.entries(themes[key]))
const roots = toArray(
themes[key]['color-scheme'] === 'light'
? [`[data-theme="${key}"],[data-theme="${key}"] *,[data-theme="${key}"] ::before,[data-theme="${key}"] ::after`, `[data-theme="${key}"] ::backdrop`]
: [`html.dark [data-theme="${key}"],html.dark [data-theme="${key}"] *,html.dark [data-theme="${key}"] ::before,html.dark [data-theme="${key}"] ::after`, `html.dark [data-theme="${key}"] ::backdrop`],
)
returnCss.push(roots.map(root => `${root}{${css}}`).join(''))
})
return returnCss.join('')
},
},
],
theme: {
colors: {
'ui-primary': 'rgb(var(--ui-primary))',
'ui-text': 'rgb(var(--ui-text))',
},
},
presets: [
presetUno(),
presetAttributify(),
presetIcons({
extraProperties: {
'display': 'inline-block',
'vertical-align': 'middle',
},
}),
presetTypography(),
],
transformers: [
transformerDirectives(),
transformerVariantGroup(),
transformerCompileClass(),
],
configDeps: [
'themes/index.ts',
],
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。