feat: unocss + vite config

This commit is contained in:
菲鸽 2024-01-29 12:58:59 +08:00
parent 3ba37d9b05
commit 61f3b4f1ee
2 changed files with 8 additions and 9 deletions

View File

@ -25,8 +25,15 @@ export default defineConfig({
},
}),
],
/**
*
* @see https://github.com/unocss/unocss#shortcuts
*/
shortcuts: [['center', 'flex justify-center items-center']],
transformers: [
// 启用 @apply 功能
transformerDirectives(),
// 启用 () 分组功能
// 支持css class组合eg: `<div class="hover:(bg-gray-400 font-medium) font-(light mono)">测试 unocss</div>`
transformerVariantGroup(),
],

View File

@ -130,6 +130,7 @@ export default ({ command, mode }) => {
// },
// }),
],
css: {
postcss: {
plugins: [
@ -150,15 +151,6 @@ export default ({ command, mode }) => {
host: '0.0.0.0',
hmr: true,
port: Number.parseInt(env.VITE_APP_PORT, 10),
// 自定义代理规则
proxy: {
// 选项写法
'/api': {
target: 'http://localhost:6666',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
build: {
minify: 'terser',