Skip to content

Commit a5b0d39

Browse files
committed
init
1 parent 13bdf73 commit a5b0d39

3 files changed

Lines changed: 23 additions & 85 deletions

File tree

2024-07-13-11-45-30.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
1. GitHub Pages部署失败,显示 "Deploy Next.js site to Pages / build (push) Failing after 21s"。
55
2. npm依赖解析错误:React和ReactDOM版本不兼容。
66
3. package-lock.json与package.json版本不匹配。
7-
4. webpack错误:无法处理CSS文件中的导入语法
7+
4. webpack错误:无法处理CSS文件中的导入语法和自定义指令
88

99
## 原因分析
1010
1. Next.js 15.x版本需要特定的静态导出配置
@@ -13,6 +13,7 @@
1313
4. React与react-dom版本不兼容
1414
5. CI环境中的package-lock.json与更新后的package.json不同步
1515
6. CSS文件中使用了旧版本的Tailwind导入语法(`@import "tailwindcss"`),不兼容Tailwind 4.x
16+
7. CSS文件中使用了非标准的CSS指令(`@custom-variant``@theme inline``@theme`),这些指令在标准CSS处理过程中不被支持
1617

1718
## 解决方案
1819

@@ -54,6 +55,17 @@ export default nextConfig;
5455
@tailwind components;
5556
@tailwind utilities;
5657
```
58+
- 移除非标准CSS指令,如 `@custom-variant``@theme inline``@theme`,替换为标准CSS:
59+
```css
60+
.dark * {
61+
/* 替代 @custom-variant dark (&:is(.dark *)); */
62+
}
63+
64+
/* 将 @theme inline 替换为直接在 :root 中定义变量 */
65+
:root {
66+
--breakpoint-3xl: 112rem;
67+
}
68+
```
5769

5870
### 4. 修复包依赖
5971
- 添加autoprefixer和postcss依赖

app/(default)/(project)/FreeTacMan/globals.css

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,11 @@
22
@tailwind components;
33
@tailwind utilities;
44

5-
@custom-variant dark (&:is(.dark *));
6-
7-
@theme inline {
8-
--color-background: var(--background);
9-
--color-foreground: var(--foreground);
10-
--color-sidebar-ring: var(--sidebar-ring);
11-
--color-sidebar-border: var(--sidebar-border);
12-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
13-
--color-sidebar-accent: var(--sidebar-accent);
14-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
15-
--color-sidebar-primary: var(--sidebar-primary);
16-
--color-sidebar-foreground: var(--sidebar-foreground);
17-
--color-sidebar: var(--sidebar);
18-
--color-chart-5: var(--chart-5);
19-
--color-chart-4: var(--chart-4);
20-
--color-chart-3: var(--chart-3);
21-
--color-chart-2: var(--chart-2);
22-
--color-chart-1: var(--chart-1);
23-
--color-ring: var(--ring);
24-
--color-input: var(--input);
25-
--color-border: var(--border);
26-
--color-destructive: var(--destructive);
27-
--color-accent-foreground: var(--accent-foreground);
28-
--color-accent: var(--accent);
29-
--color-muted-foreground: var(--muted-foreground);
30-
--color-muted: var(--muted);
31-
--color-secondary-foreground: var(--secondary-foreground);
32-
--color-secondary: var(--secondary);
33-
--color-primary-foreground: var(--primary-foreground);
34-
--color-primary: var(--primary);
35-
--color-popover-foreground: var(--popover-foreground);
36-
--color-popover: var(--popover);
37-
--color-card-foreground: var(--card-foreground);
38-
--color-card: var(--card);
39-
--radius-sm: calc(var(--radius) - 4px);
40-
--radius-md: calc(var(--radius) - 2px);
41-
--radius-lg: var(--radius);
42-
--radius-xl: calc(var(--radius) + 4px);
5+
.dark * {
6+
/* 替代 @custom-variant dark (&:is(.dark *)); */
437
}
448

9+
/* CSS变量定义,替代@theme inline */
4510
:root {
4611
--o-blue: #00a0e8;
4712
--o-light-blue: #53c2f0;
@@ -115,7 +80,7 @@
11580
--sidebar-ring: oklch(0.556 0 0);
11681
}
11782

118-
@theme {
83+
:root {
11984
--breakpoint-3xl: 120rem;
12085
}
12186

app/globals.css

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,11 @@
22
@tailwind components;
33
@tailwind utilities;
44

5-
@custom-variant dark (&:is(.dark *));
6-
7-
@theme inline {
8-
--color-o-blue: var(--o-blue);
9-
--color-o-light-blue: var(--o-light-blue);
10-
--color-o-dark-blue: var(--o-dark-blue);
11-
--color-o-gray: var(--o-gray);
12-
--color-background: var(--background);
13-
--color-foreground: var(--foreground);
14-
--color-sidebar-ring: var(--sidebar-ring);
15-
--color-sidebar-border: var(--sidebar-border);
16-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
17-
--color-sidebar-accent: var(--sidebar-accent);
18-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
19-
--color-sidebar-primary: var(--sidebar-primary);
20-
--color-sidebar-foreground: var(--sidebar-foreground);
21-
--color-sidebar: var(--sidebar);
22-
--color-chart-5: var(--chart-5);
23-
--color-chart-4: var(--chart-4);
24-
--color-chart-3: var(--chart-3);
25-
--color-chart-2: var(--chart-2);
26-
--color-chart-1: var(--chart-1);
27-
--color-ring: var(--ring);
28-
--color-input: var(--input);
29-
--color-border: var(--border);
30-
--color-destructive: var(--destructive);
31-
--color-accent-foreground: var(--accent-foreground);
32-
--color-accent: var(--accent);
33-
--color-muted-foreground: var(--muted-foreground);
34-
--color-muted: var(--muted);
35-
--color-secondary-foreground: var(--secondary-foreground);
36-
--color-secondary: var(--secondary);
37-
--color-primary-foreground: var(--primary-foreground);
38-
--color-primary: var(--primary);
39-
--color-popover-foreground: var(--popover-foreground);
40-
--color-popover: var(--popover);
41-
--color-card-foreground: var(--card-foreground);
42-
--color-card: var(--card);
43-
--radius-sm: calc(var(--radius) - 4px);
44-
--radius-md: calc(var(--radius) - 2px);
45-
--radius-lg: var(--radius);
46-
--radius-xl: calc(var(--radius) + 4px);
5+
.dark * {
6+
/* 替代 @custom-variant dark (&:is(.dark *)); */
477
}
488

9+
/* CSS变量定义,替代@theme inline */
4910
:root {
5011
--o-blue: #00a0e8;
5112
--o-light-blue: #53c2f0;
@@ -123,10 +84,10 @@
12384
--sidebar-ring: oklch(0.708 0 0);
12485
}
12586

126-
127-
@theme {
128-
--breakpoint-3xl: 112rem;
87+
:root {
88+
--breakpoint-3xl: 112rem;
12989
}
90+
13091
@layer base {
13192
* {
13293
@apply border-border outline-ring/50;

0 commit comments

Comments
 (0)