feat: replace Tailwind with UnoCSS

Faster dev HMR, native Astro 6 support, same utility class names.
Tokens migrated to uno.config.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
TerryM
2026-05-12 16:26:01 +08:00
parent 264f66bea5
commit c06d6bc3c3
6 changed files with 1873 additions and 997 deletions

View File

@@ -1,6 +1,6 @@
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
import UnoCSS from '@unocss/astro';
export default defineConfig({
integrations: [tailwind()],
integrations: [UnoCSS({ injectReset: true })],
});

2818
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,7 @@
"astro": "^6.3.1"
},
"devDependencies": {
"@astrojs/tailwind": "^6.0.2",
"tailwindcss": "^3.4.19"
"@unocss/astro": "^66.6.8",
"unocss": "^66.6.8"
}
}

View File

@@ -1,3 +1 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
/* UnoCSS handles reset and utilities via astro.config.mjs injectReset */

View File

@@ -1,21 +0,0 @@
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,ts,tsx}'],
theme: {
extend: {
colors: {
brand: '#f28a4b',
'text-primary': '#2e2a28',
'text-secondary': '#7a726d',
surface: '#f8f3ee',
'surface-alt': '#f2eae3',
'surface-footer': '#efe6de',
'border-light': '#e3d9d1',
},
fontFamily: {
sans: ['Inter', 'sans-serif'],
},
},
},
plugins: [],
}

19
uno.config.ts Normal file
View File

@@ -0,0 +1,19 @@
import { defineConfig, presetWind } from 'unocss'
export default defineConfig({
presets: [presetWind()],
theme: {
colors: {
brand: '#f28a4b',
'text-primary': '#2e2a28',
'text-secondary': '#7a726d',
surface: '#f8f3ee',
'surface-alt': '#f2eae3',
'surface-footer': '#efe6de',
'border-light': '#e3d9d1',
},
fontFamily: {
sans: ['Inter', 'sans-serif'],
},
},
})