chore(tailwindcss): 迁移到零配置编译

This commit is contained in:
SvenFE
2025-08-31 01:54:40 +08:00
parent 011cb0ae8c
commit 25640a2ced
10 changed files with 682 additions and 3377 deletions

14
.prettierignore Normal file
View File

@@ -0,0 +1,14 @@
# Ignore everything
/*
# Except these files & folders
!/src
!hero.ts
!tsconfig.json
!eslint.config.ts
!postcss.config.js
!README.md
# Ignore auto generated routeTree.gen.ts
/src/components/magicui/*.tsx
/src/components/ui/*.tsx

14
.prettierrc Normal file
View File

@@ -0,0 +1,14 @@
{
"arrowParens": "always",
"semi": false,
"tabWidth": 2,
"printWidth": 80,
"singleQuote": true,
"jsxSingleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"endOfLine": "lf",
"plugins": [
"prettier-plugin-tailwindcss"
]
}

View File

@@ -4,7 +4,7 @@
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"config": "",
"css": "src/styles/globals.css",
"baseColor": "neutral",
"cssVariables": true,

15
hero.ts Normal file
View File

@@ -0,0 +1,15 @@
import { heroui } from '@heroui/theme'
export default heroui({
themes: {
light: {
colors: {
primary: '#BD1A2D',
},
},
dark: {
colors: {
primary: '#BD1A2D',
},
},
},
})

View File

@@ -11,21 +11,26 @@
"start": "next start",
"lint:fix": "eslint . --ext .ts,.tsx -c .eslintrc.json --fix",
"lint:check": "next lint",
"format:check": "prettier --check .",
"type:generate": "./generate-types.sh"
},
"dependencies": {
"@heroui/button": "2.2.22",
"@heroui/code": "2.2.16",
"@heroui/input": "2.4.22",
"@heroui/kbd": "2.2.17",
"@heroui/link": "2.2.19",
"@heroui/listbox": "2.3.21",
"@heroui/navbar": "2.2.20",
"@heroui/react": "^2.7.11",
"@heroui/snippet": "2.2.23",
"@heroui/switch": "2.2.20",
"@heroui/system": "2.4.18",
"@heroui/theme": "2.4.17",
"@heroui/avatar": "^2.2.20",
"@heroui/button": "2.2.24",
"@heroui/card": "^2.2.23",
"@heroui/chip": "^2.2.20",
"@heroui/code": "2.2.18",
"@heroui/input": "2.4.25",
"@heroui/kbd": "2.2.19",
"@heroui/link": "2.2.21",
"@heroui/listbox": "2.3.23",
"@heroui/modal": "^2.2.21",
"@heroui/navbar": "2.2.22",
"@heroui/snippet": "2.2.25",
"@heroui/switch": "2.2.22",
"@heroui/system": "2.4.20",
"@heroui/theme": "2.4.20",
"@heroui/toast": "^2.0.14",
"@radix-ui/react-dialog": "^1.1.14",
"@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slot": "^1.2.3",
@@ -56,36 +61,31 @@
"zustand": "^5.0.6"
},
"devDependencies": {
"@eslint/compat": "1.3.2",
"@eslint/eslintrc": "3.3.1",
"@eslint/js": "9.34.0",
"@next/eslint-plugin-next": "15.5.2",
"@react-types/shared": "3.32.0",
"@redux-devtools/extension": "^3.3.0",
"@tailwindcss/postcss": "^4.1.12",
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
"@types/node": "24.3.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@typescript-eslint/eslint-plugin": "8.41.0",
"@typescript-eslint/parser": "8.41.0",
"autoprefixer": "10.4.21",
"eslint": "9.34.0",
"eslint-config-next": "15.5.2",
"eslint-config-prettier": "10.1.8",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "5.5.4",
"eslint-plugin-react": "7.37.5",
"eslint-plugin-react-hooks": "5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"eslint-plugin-unused-imports": "4.2.0",
"globals": "16.3.0",
"openapi-typescript": "^7.8.0",
"postcss": "8.5.6",
"prettier": "3.6.2",
"tailwind-variants": "1.0.0",
"tailwindcss": "3.4.17",
"prettier-plugin-tailwindcss": "^0.6.14",
"tailwind-variants": "3.1.0",
"tailwindcss": "4.1.12",
"tw-animate-css": "^1.3.7",
"typescript": "5.8.3",
"typescript-eslint": "^8.41.0"
},

3908
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
onlyBuiltDependencies:
- '@heroui/shared-utils'
- '@tailwindcss/oxide'
- protobufjs
- sharp
- unrs-resolver

View File

@@ -1,4 +1,5 @@
export const plugins = {
tailwindcss: {},
autoprefixer: {},
};
const config = {
plugins: ['@tailwindcss/postcss'],
}
export default config

View File

@@ -1,3 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import 'tailwindcss';
@import 'tw-animate-css';
@plugin '../../hero.ts';
@source '../../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}';
@custom-variant dark (&:is(.dark *));

View File

@@ -1,42 +0,0 @@
import { heroui } from "@heroui/theme";
import type { Config } from "tailwindcss";
const config: Config = {
content: [
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
"./node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}",
"./pages/**/*.{ts,tsx}",
"./components/**/*.{ts,tsx}",
"./app/**/*.{ts,tsx}",
"./src/**/*.{ts,tsx}",
],
theme: {
extend: {
fontFamily: {
sans: ["var(--font-sans)"],
mono: ["var(--font-mono)"],
},
},
},
darkMode: ["class", "class"],
plugins: [
heroui({
themes: {
light: {
colors: {
primary: "#BD1A2D",
},
},
dark: {
colors: {
primary: "#BD1A2D",
},
},
},
}),
require("tailwindcss-animate"),
],
};
module.exports = config;