generated from polymech/site-template
122 lines
2.9 KiB
JavaScript
122 lines
2.9 KiB
JavaScript
import { defineConfig } from 'astro/config'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import { imagetools } from "imagetools"
|
|
import react from "@astrojs/react"
|
|
import mdx from "@astrojs/mdx";
|
|
import { defineConfig } from 'astro/config';
|
|
import sitemap from "@astrojs/sitemap";
|
|
import { rehypeAccessibleEmojis } from 'rehype-accessible-emojis';
|
|
import getReadingTime from 'reading-time';
|
|
import { toString } from 'mdast-util-to-string';
|
|
import { PolymechInstance } from "@polymech/astro-base/registry";
|
|
|
|
import { loadConfig } from '@polymech/astro-base/app/config-loader';
|
|
|
|
// import domainExpansion from '@domain-expansion/astro';
|
|
import yargs from 'yargs'
|
|
import { hideBin } from 'yargs/helpers'
|
|
|
|
const argv = yargs(hideBin(process.argv)).argv;
|
|
const config = loadConfig();
|
|
|
|
PolymechInstance.setConfig({
|
|
...config,
|
|
callbacks: {
|
|
onConfigUpdate: (config) => {
|
|
//console.log('MyPages config updated:', config);
|
|
},
|
|
onLanguageChange: (lang) => {
|
|
console.log('Language changed to:', lang);
|
|
},
|
|
onRouteRender: (path, { lang, slug }) => {
|
|
console.log('Route rendered:', path, { lang, slug });
|
|
},
|
|
get: (path, { lang, slug }) => {
|
|
//console.log('Getting data for:2', path, { lang, slug });
|
|
return {
|
|
title: 'Product Page',
|
|
description: 'This is a product page',
|
|
sharedPageText: 'This is shared text'
|
|
};
|
|
}
|
|
}
|
|
});
|
|
|
|
export function remarkReadingTime() {
|
|
return function (tree, { data }) {
|
|
const textOnPage = toString(tree);
|
|
const readingTime = getReadingTime(textOnPage);
|
|
data.astro.frontmatter.minutesRead = readingTime.text;
|
|
};
|
|
}
|
|
|
|
export default defineConfig({
|
|
site: 'https://creava.org',
|
|
devToolbar: {
|
|
enabled: false,
|
|
},
|
|
i18n: {
|
|
locales: ['en'],
|
|
defaultLocale: "en",
|
|
},
|
|
sidebar: [
|
|
{
|
|
label: 'How-To Guides',
|
|
items: [
|
|
{ label: 'All Guides', link: '/howtos' },
|
|
{ label: 'Browse by Category', link: '/howtos#categories' },
|
|
],
|
|
},
|
|
],
|
|
alias: {
|
|
"@base": "../polymech-site/src"
|
|
},
|
|
vite: {
|
|
resolve: {
|
|
alias: {
|
|
'@components': '/src/components',
|
|
'@layouts': '/src/layouts'
|
|
}
|
|
},
|
|
plugins: [
|
|
tailwindcss({
|
|
config: './tailwind.config.cjs',
|
|
jit: true
|
|
}),
|
|
],
|
|
build: {
|
|
target: 'esnext',
|
|
assetsDir: './assets',
|
|
modulePreload: { polyfill: false },
|
|
commonjsOptions: { esmExternals: true },
|
|
assetsInlineLimit: 1024,
|
|
sourcemap: false,
|
|
},
|
|
ssr: {
|
|
external: ['cacache', 'glob', 'xlsx', 'sharp', '@polymech/kbot-d']
|
|
}
|
|
},
|
|
markdown: {
|
|
drafts: true,
|
|
shikiConfig: {
|
|
theme: "github-light-default"
|
|
}
|
|
},
|
|
shikiConfig: {
|
|
wrap: true,
|
|
skipInline: false,
|
|
drafts: true
|
|
},
|
|
integrations: [
|
|
sitemap({}),
|
|
mdx({
|
|
rehypePlugins: [
|
|
rehypeAccessibleEmojis,
|
|
remarkReadingTime
|
|
],
|
|
}),
|
|
//AstroPWA({}),
|
|
react(),
|
|
imagetools
|
|
]
|
|
}); |