2024-01-21 12:54:41 +08:00
|
|
|
import tailwind from "@astrojs/tailwind"
|
|
|
|
import Compress from "astro-compress"
|
|
|
|
import icon from "astro-icon"
|
|
|
|
import { defineConfig } from "astro/config"
|
|
|
|
import Color from "colorjs.io"
|
|
|
|
import rehypeAutolinkHeadings from "rehype-autolink-headings"
|
|
|
|
import rehypeKatex from "rehype-katex"
|
|
|
|
import rehypeSlug from "rehype-slug"
|
|
|
|
import remarkMath from "remark-math"
|
|
|
|
import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs"
|
2024-02-18 18:13:43 +08:00
|
|
|
import svelte from "@astrojs/svelte"
|
2024-03-12 14:04:58 +08:00
|
|
|
import swup from '@swup/astro';
|
2024-04-22 23:48:31 +08:00
|
|
|
import sitemap from '@astrojs/sitemap';
|
2023-09-26 14:27:38 +08:00
|
|
|
|
2024-01-21 12:54:41 +08:00
|
|
|
const oklchToHex = (str) => {
|
|
|
|
const DEFAULT_HUE = 250
|
|
|
|
const regex = /-?\d+(\.\d+)?/g
|
|
|
|
const matches = str.string.match(regex)
|
|
|
|
const lch = [matches[0], matches[1], DEFAULT_HUE]
|
|
|
|
return new Color("oklch", lch).to("srgb").toString({
|
|
|
|
format: "hex",
|
|
|
|
})
|
2023-09-26 14:27:38 +08:00
|
|
|
}
|
|
|
|
|
2024-01-21 12:54:41 +08:00
|
|
|
// https://astro.build/config
|
2023-09-26 14:27:38 +08:00
|
|
|
export default defineConfig({
|
2024-01-21 12:54:41 +08:00
|
|
|
site: "https://fuwari.vercel.app/",
|
|
|
|
base: "/",
|
2023-09-26 14:27:38 +08:00
|
|
|
integrations: [
|
|
|
|
tailwind(),
|
2024-03-12 14:04:58 +08:00
|
|
|
swup({
|
|
|
|
theme: false,
|
|
|
|
animationClass: 'transition-',
|
|
|
|
containers: ['main'],
|
|
|
|
smoothScrolling: true,
|
|
|
|
cache: true,
|
|
|
|
preload: true,
|
|
|
|
accessibility: true,
|
|
|
|
globalInstance: true,
|
|
|
|
}),
|
2023-09-26 14:27:38 +08:00
|
|
|
icon({
|
|
|
|
include: {
|
2024-01-21 12:54:41 +08:00
|
|
|
"material-symbols": ["*"],
|
|
|
|
"fa6-brands": ["*"],
|
|
|
|
"fa6-regular": ["*"],
|
|
|
|
"fa6-solid": ["*"],
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
Compress({
|
|
|
|
Image: false,
|
|
|
|
}),
|
2024-02-18 18:13:43 +08:00
|
|
|
svelte(),
|
2024-04-22 23:48:31 +08:00
|
|
|
sitemap(),
|
2023-09-26 14:27:38 +08:00
|
|
|
],
|
|
|
|
markdown: {
|
2023-10-29 19:27:28 +08:00
|
|
|
remarkPlugins: [remarkMath, remarkReadingTime],
|
2024-01-21 12:54:41 +08:00
|
|
|
rehypePlugins: [
|
|
|
|
rehypeKatex,
|
|
|
|
rehypeSlug,
|
|
|
|
[
|
|
|
|
rehypeAutolinkHeadings,
|
|
|
|
{
|
|
|
|
behavior: "append",
|
|
|
|
properties: {
|
|
|
|
className: ["anchor"],
|
|
|
|
},
|
|
|
|
content: {
|
|
|
|
type: "element",
|
|
|
|
tagName: "span",
|
|
|
|
properties: {
|
|
|
|
className: ["anchor-icon"],
|
2024-01-24 12:28:16 +08:00
|
|
|
'data-pagefind-ignore': true,
|
2024-01-21 12:54:41 +08:00
|
|
|
},
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
type: "text",
|
|
|
|
value: "#",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2023-09-26 14:27:38 +08:00
|
|
|
},
|
|
|
|
vite: {
|
|
|
|
css: {
|
|
|
|
preprocessorOptions: {
|
|
|
|
stylus: {
|
|
|
|
define: {
|
2024-01-21 12:54:41 +08:00
|
|
|
oklchToHex: oklchToHex,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-09-26 14:27:38 +08:00
|
|
|
},
|
2024-01-21 12:54:41 +08:00
|
|
|
})
|