-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathvite-css.config.ts
More file actions
73 lines (68 loc) · 1.78 KB
/
vite-css.config.ts
File metadata and controls
73 lines (68 loc) · 1.78 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
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
import { defineConfig } from 'vite';
import { resolve } from 'path';
import autoprefixer from 'autoprefixer';
import postcssSvg from 'postcss-svg';
import cssnano from 'cssnano';
import banner from 'vite-plugin-banner';
const copyright = `Chi and its documentation are released under the terms of the MIT license.
In addition, Chi uses several 3rd-party libraries,
a list of which can be viewed in the package.json file.
Please review each of their license and user agreements, as well.`;
const themeName = (theme) => (theme === 'lumen' ? 'chi' : `chi-${theme}`);
export default defineConfig({
plugins: [banner(copyright)],
resolve: {
alias: {
'@': resolve(__dirname, './src'),
},
},
css: {
preprocessorOptions: {
// Not available in Vite 7.0.0
scss: {
api: 'legacy',
includePaths: [
resolve(__dirname, `src/chi/themes/${process.env.THEME}`),
resolve(__dirname, 'src/chi')
],
},
},
postcss: {
plugins: [
autoprefixer({
overrideBrowserslist: ['last 2 versions', 'ie >= 10'],
}),
postcssSvg({
dirs: [resolve(__dirname, 'src/chi/assets/icons')],
}),
cssnano({
preset: [
'default',
{
discardComments: {
removeAll: true,
},
},
],
}),
],
},
},
build: {
target: 'esnext',
outDir: 'dist',
emptyOutDir: false,
minify: 'esbuild',
rollupOptions: {
input: {
[themeName(process.env.THEME)]: resolve(__dirname, `src/chi/themes/${process.env.THEME}/index.scss`),
},
output: {
assetFileNames: '[name].css',
},
},
},
define: {
'import.meta.env.MODE': '"production"',
},
});