Skip to content

Commit

Permalink
Merge pull request #35 from xlgzsgf/astro
Browse files Browse the repository at this point in the history
feat: ✨ Rework UI and Improve Responsiveness, Clean Up Codebase
  • Loading branch information
zxypro1 authored Nov 11, 2024
2 parents c78b871 + 15c7ee2 commit 83382a8
Show file tree
Hide file tree
Showing 79 changed files with 3,986 additions and 1,276 deletions.
58 changes: 8 additions & 50 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,42 +1,21 @@
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import partytown from "@astrojs/partytown";
import preact from "@astrojs/preact";
import { autoImportComponents } from "@serverless-cd/goat-ui/src/utils";
import tailwind from "@astrojs/tailwind";
import icon from "astro-icon";
// import compress from 'astro-compress';
import rehypeExternalLinks from "rehype-external-links";

import {
addPrefixImageLink,
remarkRemoveMdLinks,
remarkRemovePlainLanguageCode,
remarkRemoveRepeatHeader,
setLinkReferrer,
} from "./src/utils/frontmatter.mjs";
import { ANALYTICS, SIDEBAR, SITE } from "./src/utils/config.ts";
import { starlightAsides } from "./node_modules/@astrojs/starlight/integrations/asides";
import { SIDEBAR, SITE } from "./src/utils/config.ts";
import topLevelAwait from "vite-plugin-top-level-await";
import starlightUtils from "@lorenzo_lewis/starlight-utils";

const whenExternalScripts = (items = []) =>
ANALYTICS.vendors.googleAnalytics.id &&
ANALYTICS.vendors.googleAnalytics.partytown
? Array.isArray(items)
? items.map((item) => item())
: [items()]
: [];

// https://astro.build/config
export default defineConfig({
site: process.env.DEPLOY_SITE || SITE.site,
base: SITE.base,
//设置处理后斜杠的策略
trailingSlash: SITE.trailingSlash,
image: {
domain: ["img.alicdn"],
},

integrations: [
autoImportComponents(),
starlight({
Expand All @@ -46,6 +25,11 @@ export default defineConfig({
src: "./src/assets/logo.png",
replacesTitle: true,
},
//自定义组件
components: {
//重写主题提供组件,实现默认深色主题
ThemeProvider: "./src/components/ThemeProvider.astro",
},
disable404Route: true,
social: {
github: "https://github.com/Serverless-Devs/Serverless-Devs",
Expand All @@ -56,6 +40,7 @@ export default defineConfig({
editLink: {
baseUrl: SITE.websiteGithubUrl,
},
//多路侧边栏设置
sidebar: SIDEBAR,
plugins: [
starlightUtils({
Expand All @@ -64,41 +49,14 @@ export default defineConfig({
},
}),
],
// locales,
// customCss: ['./src/style/global.css','./src/style/fonts.css'],
}),
tailwind({ applyBaseStyles: false }),
icon({
tabler: ["book", "pencil"],
"ant-design": ["github-filled"],
basil: ["document-outline"],
}),
preact({ compat: true }),
...whenExternalScripts(() =>
partytown({
config: { forward: ["dataLayer.push"] },
}),
),
],
markdown: {
rehypePlugins: [
// 在这里添加 rehype-external-links 插件配置
[
rehypeExternalLinks,
{
target: "_blank",
},
],
],
remarkPlugins: [
remarkRemoveMdLinks,
remarkRemovePlainLanguageCode,
remarkRemoveRepeatHeader,
addPrefixImageLink,
starlightAsides,
setLinkReferrer,
],
},
vite: {
build: {
target: "chrome68",
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@astrojs/starlight": "^0.24.0",
"@astrojs/starlight-tailwind": "^2.0.1",
"@astrojs/tailwind": "^5.1.0",
"@b-design/color": "^1.0.7",
"@docsearch/css": "^3.5.2",
"@docsearch/js": "^3.5.2",
"@fontsource-variable/bricolage-grotesque": "^5.0.6",
Expand Down
13 changes: 12 additions & 1 deletion src/assets/CNCF.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/fonts/Roboto-Black.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-BlackItalic.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-Bold.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-BoldItalic.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-Italic.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-Light.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-LightItalic.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-Medium.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-MediumItalic.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-Regular.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-Thin.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-ThinItalic.ttf
Binary file not shown.
Binary file added src/assets/fonts/SourceHanSansCN-Bold.ttf
Binary file not shown.
Binary file added src/assets/fonts/SourceHanSansCN-ExtraLight.ttf
Binary file not shown.
Binary file added src/assets/fonts/SourceHanSansCN-Heavy.ttf
Binary file not shown.
Binary file added src/assets/fonts/SourceHanSansCN-Light.ttf
Binary file not shown.
Binary file added src/assets/fonts/SourceHanSansCN-Medium.ttf
Binary file not shown.
Binary file added src/assets/fonts/SourceHanSansCN-Normal.ttf
Binary file not shown.
Binary file added src/assets/fonts/SourceHanSansCN-Regular.ttf
Binary file not shown.
112 changes: 112 additions & 0 deletions src/assets/home/AISupport/background.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 83382a8

Please sign in to comment.