-
Notifications
You must be signed in to change notification settings - Fork 1
/
astro.config.mjs
46 lines (43 loc) · 1.6 KB
/
astro.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* eslint-disable turbo/no-undeclared-env-vars */
import { defineConfig } from "astro/config";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
/*
We are doing some URL mumbo jumbo here to tell Astro what the URL of your website will be.
In local development, your SEO meta tags will have localhost URL.
In built production websites, your SEO meta tags should have your website URL.
So we give our website URL here and the template will know what URL to use
for meta tags during build.
If you don't know your website URL yet, don't worry about this
and leave it empty or use localhost URL. It won't break anything.
*/
const SERVER_PORT = 3000;
// the url to access your blog during local development
const LOCALHOST_URL = `http://localhost:${SERVER_PORT}`;
// the url to access your blog after deploying it somewhere (Eg. Netlify)
const LIVE_URL = "https://micro-frontend.org/tractor-store/";
// this is the astro command your npm script runs
const SCRIPT = process.env.npm_lifecycle_script || "";
const isBuild = SCRIPT.includes("astro build");
let BASE_URL = LOCALHOST_URL;
// When you're building your site in local or in CI, you could just set your URL manually
if (isBuild) {
BASE_URL = LIVE_URL;
}
const assetsPrefix = isBuild
? "https://neuland.github.io/tractor-store/"
: undefined;
export default defineConfig({
server: { port: SERVER_PORT },
site: BASE_URL,
base: "/tractor-store/",
trailingSlash: "always",
compressHTML: true,
integrations: [
sitemap(),
tailwind({
config: { applyBaseStyles: false },
}),
],
build: { assetsPrefix },
});