-
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
Expand file tree
/
Copy pathvite.config.styles.ts
More file actions
38 lines (34 loc) · 799 Bytes
/
vite.config.styles.ts
File metadata and controls
38 lines (34 loc) · 799 Bytes
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
import { resolve } from 'path';
import { defineConfig } from 'vite';
import fs from 'fs';
// List all theme files in the css/theme directory
const themeFiles = fs
.readdirSync(resolve(__dirname, 'css/theme'))
.filter((file) => file.endsWith('.scss'));
const themeEntries = themeFiles.reduce((acc, file) => {
acc[`theme/${file.replace('.scss', '')}`] = resolve(__dirname, `css/theme/${file}`);
return acc;
}, {});
export default defineConfig({
root: './',
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
},
},
build: {
emptyOutDir: false,
cssCodeSplit: true,
lib: {
formats: ['es'],
entry: {
reveal: resolve(__dirname, 'css/reveal.scss'),
reset: resolve(__dirname, 'css/reset.css'),
...themeEntries,
},
},
},
plugins: [],
});