-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
48 lines (46 loc) · 1.32 KB
/
vite.config.js
File metadata and controls
48 lines (46 loc) · 1.32 KB
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
import { copyFileSync, mkdirSync, readdirSync } from 'fs';
import { join } from 'path';
import { defineConfig } from 'vite';
import prism from 'vite-plugin-prismjs';
export default defineConfig({
root: './',
base: '/markdown-viewer-app/',
build: {
outDir: 'dist',
},
server: {
port: 3000,
open: true,
},
plugins: [
prism({
languages: 'all', // Load ALL languages for future-proofing
plugins: ['line-numbers'],
theme: 'tomorrow',
css: true,
}),
{
name: 'copy-themes',
closeBundle() {
// Copy themes folder to dist after build
const themesSource = join(process.cwd(), 'themes');
const themesDest = join(process.cwd(), 'dist', 'themes');
try {
mkdirSync(themesDest, { recursive: true });
const files = readdirSync(themesSource);
files.forEach(file => {
if (file.endsWith('.css')) {
copyFileSync(join(themesSource, file), join(themesDest, file));
console.log(`📋 Copied theme: ${file}`);
}
});
console.log(
`✅ All ${files.filter(f => f.endsWith('.css')).length} theme files copied to dist/themes/`
);
} catch (error) {
console.error('❌ Error copying themes:', error);
}
},
},
],
});