Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"@rspress/plugin-preview": "^1.44.0",
"@tailwindcss/postcss": "^4.1.11",
"@types/node": "^18.11.17",
"autoprefixer": "^10.4.22",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The autoprefix feature has been built in since tailwindcss v4. In addition, rspress is based on ByteDance's Rspack compiler, and the lightningcss used by Rspack also supports this function. This seems redundant.

"postcss": "^8.5.6",
"tailwindcss": "^4.1.10"
"tailwindcss": "^4.1.17"
}
}
2 changes: 1 addition & 1 deletion docs/rspress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default defineConfig({
message: "MIT Licensed | © 2025 DevCloudFE. All Rights Reserved.",
},
},
globalStyles: path.resolve(__dirname, "./docs/tailwind.css"),
globalStyles: path.resolve(__dirname, "theme/styles/index.css"),
route: {
cleanUrls: true,
},
Expand Down
16 changes: 16 additions & 0 deletions docs/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a misunderstanding. The tailwin.config.js configuration file has been deprecated since tailwind v4, and tailwind 4 actually does not use this file.

content: [
"./docs/**/*.{md,mdx,js,ts,jsx,tsx}",
"./theme/**/*.{js,ts,jsx,tsx}",
],
darkMode: ["selector"],
theme: {
extend: {
colors: {
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: "hsl(var(--primary))",
},
},
},
};
40 changes: 40 additions & 0 deletions docs/theme/styles/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@import "tailwindcss";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to implement this pattern for our main project (./src) code rather than for the documentation site.

@custom-variant dark (&:where(.dark, .dark *));

@theme {
--color-background: hsl(0 0% 100%);
--color-foreground: hsl(222.2 84% 4.9%);
--color-primary: hsl(221.2 83.2% 53.3%);

--color-background: var(--background);
--color-foreground: var(--foreground);
--color-primary: var(--primary);

--rp-c-bg: var(--color-background);
--rp-c-text: var(--color-foreground);
--rp-c-brand: var(--color-primary);
--rp-c-brand-light: color-mix(in srgb, var(--color-primary) 80%, transparent);
}

:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--primary: 221.2 83.2% 53.3%;
}

.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--primary: 217.2 91.2% 59.8%;
}

@layer base {
body {
@apply bg-background text-foreground;
}
}
@layer components {
.rspress-doc a {
@apply text-primary hover:underline;
}
}
3 changes: 2 additions & 1 deletion docs/theme/index.tsx → docs/theme/styles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useLang } from "rspress/runtime";
import {
HomeLayout as BasicHomeLayout,
Layout as BasicLayout,
// getCustomMDXComponent,
} from "rspress/theme";
import "./styles/index.css";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rspress uses postcss, and we have already configured tailwindcss in postCSs.config.js, so this seems confusing.


function HomeLayout() {
// const { code: Code } = getCustomMDXComponent();
Expand All @@ -21,6 +21,7 @@ const Layout = () => {
: "🚧 MateChat React 文档仍在开发中"}
</div>
}
// components={{ ... }}
/>
);
};
Expand Down
95 changes: 40 additions & 55 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 38 additions & 1 deletion src/tailwind.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
@import "tailwindcss";

@custom-variant dark (&:where(.dark, .dark *));

@theme {
--color-background: hsl(0 0% 100%);
--color-foreground: hsl(222.2 84% 4.9%);
--color-primary: hsl(221.2 83.2% 53.3%);

--color-background: var(--background);
--color-foreground: var(--foreground);
--color-primary: var(--primary);

--rp-c-bg: var(--color-background);
--rp-c-text: var(--color-foreground);
--rp-c-brand: var(--color-primary);
--rp-c-brand-light: color-mix(in srgb, var(--color-primary) 80%, transparent);
}

:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--primary: 221.2 83.2% 53.3%;
}

.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--primary: 217.2 91.2% 59.8%;
}

@layer base {
body {
@apply bg-background text-foreground;
}
}
@layer components {
.rspress-doc a {
@apply text-primary hover:underline;
}
}