The project uses UnoCSS for utility-first CSS. The configuration defines custom shortcuts, theme colors mapped to Element Plus CSS variables, and several presets and transformers to enhance developer experience.
Custom Shortcuts
You can use predefined utility shortcuts in your components. For example, the panel-title shortcut is available for consistent panel heading styling:
panel-title: Applies specific padding, font weight, leading, color (#6379bb), and border styles.
Theme Configuration
The theme is integrated with Element Plus via CSS variables. The following color keys are available:
primary: Maps to var(--el-color-primary)primary_dark: Maps to var(--el-color-primary-light-5)
Presets and Transformers
The configuration includes:
- Presets:
presetWind3(): Wind CSS compatible preset.presetAttributify(): Enables attribute-based styling.presetTypography(): Provides typography styles.presetWebFonts(): Configures web fonts.
- Transformers:
transformerDirectives(): Enables @apply and other CSS directives.transformerVariantGroup(): Enables grouping of variants (e.g., hover:(bg-gray-100 text-red-500)).
import {
defineConfig,
presetAttributify,
presetWind3,
presetTypography,
presetWebFonts,
transformerDirectives,
transformerVariantGroup
} from 'unocss';
export default defineConfig({
shortcuts: {
'panel-title':
'pb-[5px] font-sans leading-[1.1] font-medium text-base text-[#6379bb] border-b border-b-solid border-[var(--el-border-color-light)] mb-5 mt-0'
},
theme: {
colors: {
primary: 'var(--el-color-primary)',
primary_dark: 'var(--el-color-primary-light-5)'
}
},
presets: [
presetWind3(),
presetAttributify(),
presetTypography(),
presetWebFonts({
fonts: {}
})
],
transformers: [transformerDirectives(), transformerVariantGroup()]
});