From fa05359e3ff825fd7756a7af7bc9b8a1d6293a13 Mon Sep 17 00:00:00 2001 From: kennethcheng Date: Mon, 27 Apr 2026 13:17:58 +0800 Subject: [PATCH] fix: update tailwind vite plugin and finalize project --- DEV_LOG.md | 4 ++++ astro.config.mjs | 20 +++++++++++--------- src/content/docs/test.md | 5 +++++ src/pages/docs/[...slug].astro | 14 ++++++++++++++ 4 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 src/content/docs/test.md create mode 100644 src/pages/docs/[...slug].astro diff --git a/DEV_LOG.md b/DEV_LOG.md index 62e8c5a..ad25346 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -1,3 +1,7 @@ Task 1: Astro 基础脚手架已生成 Task 2: Tailwind 官方集成安装完毕 Task 3: Typography 插件配置完成 +Task 4: Markdown 解析底层依赖安装完成 +Task 5: astro.config.mjs 引擎装配完成 +Task 7: BaseLayout 闭环 +Task 8 修正:已通过替换 @tailwindcss/vite 解决配置文件路径问题,构建成功。 diff --git a/astro.config.mjs b/astro.config.mjs index c915832..efbbed5 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,16 +1,18 @@ import { defineConfig } from 'astro/config'; -import tailwind from '@astrojs/tailwind'; +import tailwind from '@tailwindcss/vite'; import remarkMath from 'remark-math'; import rehypeKatex from 'rehype-katex'; import rehypePrettyCode from 'rehype-pretty-code'; export default defineConfig({ - integrations: [tailwind()], - markdown: { - remarkPlugins: [remarkMath], - rehypePlugins: [ - rehypeKatex, - [rehypePrettyCode, { theme: 'github-dark' }] - ] - } + vite: { + plugins: [tailwind()] + }, + markdown: { + remarkPlugins: [remarkMath], + rehypePlugins: [ + rehypeKatex, + [rehypePrettyCode, { theme: 'github-dark' }] + ] + } }); diff --git a/src/content/docs/test.md b/src/content/docs/test.md new file mode 100644 index 0000000..065a758 --- /dev/null +++ b/src/content/docs/test.md @@ -0,0 +1,5 @@ +--- +title: "测试文档" +--- +# 标题 +测试公式:$E=mc^2$ diff --git a/src/pages/docs/[...slug].astro b/src/pages/docs/[...slug].astro new file mode 100644 index 0000000..26b31fd --- /dev/null +++ b/src/pages/docs/[...slug].astro @@ -0,0 +1,14 @@ +--- +import { getCollection, render } from 'astro:content'; +import BaseLayout from '../../layouts/BaseLayout.astro'; + +export async function getStaticPaths() { + const docs = await getCollection('docs'); + return docs.map(doc => ({ params: { slug: doc.id }, props: { doc } })); +} +const { doc } = Astro.props; +const { Content } = await render(doc); +--- + +
+