-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.mjs
78 lines (73 loc) · 2.1 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { defineConfig } from "astro/config";
import postcssMergeQueries from "postcss-merge-queries";
import glsl from "vite-plugin-glsl";
// import sitemap from "@astrojs/sitemap";
import * as dotenv from "dotenv";
dotenv.config();
function createDate() {
let now = new Date(),
year = String(now.getFullYear()),
month = String(now.getMonth() + 1),
date = String(now.getDate()),
hour = String(now.getHours()),
minute = String(now.getMinutes());
month = month.length === 1 ? `0${month}` : month;
return `${year}${month}${date}`;
}
const DATE = createDate(),
MODE = process.env.NODE_ENV,
SITE_URL = MODE === "production" ? process.env.PUBLIC_PROD_URL : process.env.PUBLIC_LOCAL_URL;
console.log(
`// --------------------------\n\n⚡️ ~ MODE : ${MODE}\n\n▕▔▔▔▔▔▔▔▔▔▔▔╲\n▕╮╭┻┻╮╭┻┻╮╭▕╮╲\n▕╯┃╭╮┃┃╭╮┃╰▕╯╭▏\n▕╭┻┻┻┛┗┻┻┛ ╰▏ ▏\n▕╰━━━┓┈┈┈╭╮▕╭╮▏\n▕╭╮╰┳┳┳┳╯╰╯▕╰╯▏\n▕╰╯┈┗┛┗┛┈╭╮▕╮┈▏\n\n// --------------------------\n\n🌏 ~ ${SITE_URL}\n\n// --------------------------`,
);
// https://astro.build/config
export default defineConfig({
markdown: {
drafts: true,
},
build: {
assets: "assets",
},
site: SITE_URL,
base: "/",
vite: {
esbuild: {
drop: ["console", "debugger"],
},
plugins: [glsl()],
build: {
rollupOptions: {
output: {
assetFileNames: `assets/build.[hash].${DATE}[extname]`,
entryFileNames: `assets/build.[hash].${DATE}.js`,
},
},
},
css: {
postcss: {
plugins: [postcssMergeQueries],
},
},
// server: {
// open: true,
// port: 3000,
// },
// preview: {
// open: true,
// port: 4000,
// host: true,
// },
},
plugins: ["prettier-plugin-astro"],
integrations: [],
server: {
open: true,
host: true,
port: MODE === "production" ? 4000 : 3000,
},
// preview: {
// open: true,
// host: true,
// port: 4000,
// },
});