2023-09-26 14:27:38 +08:00
|
|
|
import { defineConfig } from 'astro/config';
|
|
|
|
import yaml from '@rollup/plugin-yaml';
|
|
|
|
import icon from "astro-icon";
|
|
|
|
|
|
|
|
import tailwind from "@astrojs/tailwind";
|
|
|
|
import {remarkReadingTime} from "./src/plugins/remark-reading-time.mjs";
|
|
|
|
|
2023-10-18 02:10:01 +08:00
|
|
|
import rehypeKatex from "rehype-katex";
|
|
|
|
|
2023-09-26 14:27:38 +08:00
|
|
|
import Color from 'colorjs.io';
|
2023-10-18 02:10:01 +08:00
|
|
|
import remarkMath from "remark-math";
|
2023-09-26 14:27:38 +08:00
|
|
|
|
|
|
|
// https://astro.build/config
|
|
|
|
|
|
|
|
|
|
|
|
const oklchToHex = function (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"});
|
|
|
|
}
|
|
|
|
|
|
|
|
export default defineConfig({
|
2023-11-08 19:03:35 +08:00
|
|
|
site: 'https://fuwari.vercel.app/',
|
|
|
|
base: '/',
|
2023-09-26 14:27:38 +08:00
|
|
|
integrations: [
|
|
|
|
tailwind(),
|
|
|
|
icon({
|
|
|
|
include: {
|
|
|
|
'material-symbols': ['*'],
|
2023-11-03 14:10:54 +08:00
|
|
|
'fa6-brands': ['*'],
|
2023-11-03 15:59:14 +08:00
|
|
|
'fa6-regular': ['*'],
|
|
|
|
'fa6-solid': ['*']
|
2023-09-26 14:27:38 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
|
|
|
markdown: {
|
2023-10-29 19:27:28 +08:00
|
|
|
remarkPlugins: [remarkMath, remarkReadingTime],
|
2023-10-29 19:22:19 +08:00
|
|
|
rehypePlugins: [rehypeKatex]
|
2023-09-26 14:27:38 +08:00
|
|
|
},
|
|
|
|
redirects: {
|
|
|
|
'/': '/page/1',
|
|
|
|
},
|
|
|
|
vite: {
|
|
|
|
plugins: [yaml()],
|
|
|
|
css: {
|
|
|
|
preprocessorOptions: {
|
|
|
|
stylus: {
|
|
|
|
define: {
|
|
|
|
oklchToHex: oklchToHex
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2023-10-29 19:22:19 +08:00
|
|
|
});
|