-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
40 lines (37 loc) · 1.26 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
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
export default defineConfig({
integrations: [tailwind()],
trailingSlash: 'never',
build: {
format: 'directory',
assets: 'assets',
// Copier les fichiers PHP dans le dossier dist
copyPublicFiles: true,
// Configuration personnalisée pour copier les fichiers supplémentaires
hooks: {
'astro:build:done': async ({ dir, routes }) => {
const fs = await import('fs/promises');
const path = await import('path');
// Créer le dossier mail et PHPMailer s'ils n'existent pas
const mailDir = path.join(dir.pathname, 'mail');
const phpMailerDir = path.join(mailDir, 'PHPMailer');
await fs.mkdir(mailDir, { recursive: true });
await fs.mkdir(phpMailerDir, { recursive: true });
// Copier les fichiers PHP
await fs.copyFile(
'public/mail/send.php',
path.join(mailDir, 'send.php')
);
await fs.copyFile(
'public/mail/PHPMailer/Exception.php',
path.join(phpMailerDir, 'Exception.php')
);
await fs.copyFile(
'public/mail/PHPMailer/PHPMailer.php',
path.join(phpMailerDir, 'PHPMailer.php')
);
}
}
}
});