-
Notifications
You must be signed in to change notification settings - Fork 6
/
vite.config.js
47 lines (46 loc) · 1.14 KB
/
vite.config.js
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
import imagemin from "imagemin";
import imageminWebp from "imagemin-webp";
import path from "path";
import { defineConfig } from "vite";
import glob from "fast-glob";
import { fileURLToPath } from "url";
import { ViteImageOptimizer } from "vite-plugin-image-optimizer";
export default defineConfig({
plugins: [
ViteImageOptimizer({
png: {
quality: 86,
},
jpeg: {
quality: 86,
},
jpg: {
quality: 86,
},
}),
{
...imagemin(["./src/img/**/*.{jpg,png,jpeg}"], {
destination: "./src/img/webp/",
plugins: [imageminWebp({ quality: 86 })],
}),
apply: "serve",
},
],
build: {
minify: false, // disable minification
rollupOptions: {
input: Object.fromEntries(
glob
.sync(["./*.html", "./pages/**/*.html"])
.map((file) => [
path.relative(__dirname, file.slice(0, file.length - path.extname(file).length)),
fileURLToPath(new URL(file, import.meta.url)),
])
),
// output unminified CSS file
output: {
assetFileNames: "assets/[name].[ext]",
},
},
},
});