-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
76 lines (65 loc) · 1.7 KB
/
vite.config.js
File metadata and controls
76 lines (65 loc) · 1.7 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
74
75
76
import { defineConfig } from "vite";
import { resolve } from "path";
import { viteStaticCopy } from "vite-plugin-static-copy";
const OUT_DIR = resolve(
__dirname,
"src/sphinx_rijkshuisstijl_2008/theme/sphinx_rijkshuisstijl_2008/static",
);
export default defineConfig({
build: {
outDir: OUT_DIR,
emptyOutDir: true,
cssCodeSplit: false,
rollupOptions: {
input: {
theme: resolve(__dirname, "static/js/main.js"),
styles: resolve(__dirname, "static/scss/index.scss"),
},
output: {
entryFileNames: "js/[name].js",
assetFileNames: (assetInfo) => {
const name = assetInfo.name ?? "";
// Force single known CSS output
if (name.endsWith(".css")) {
return "css/theme.css";
}
// Fonts
if (/\.(woff2?|ttf|eot|otf)$/.test(name)) {
return "fonts/[name][extname]";
}
// Images
if (/\.(png|jpe?g|svg|gif|webp|ico)$/.test(name)) {
return "img/[name][extname]";
}
// Everything else (hash-safe)
return "assets/[name].[hash][extname]";
},
},
},
},
plugins: [
viteStaticCopy({
targets: [
{
src: "static/img/**/*.{png,jpg,jpeg,svg,gif,webp,ico}",
dest: "img",
},
{
src: "node_modules/@minvws/manon-themes/dist/rijkshuisstijl-2008/fonts/*",
dest: "fonts",
},
{
src: "node_modules/@minvws/manon-themes/dist/rijkshuisstijl-2008/img/*",
dest: "img",
},
],
}),
],
css: {
preprocessorOptions: {
scss: {
loadPaths: ["node_modules"],
},
},
},
});