-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
71 lines (66 loc) · 1.92 KB
/
vite.config.ts
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
import { defineConfig } from "vite";
import { fileURLToPath } from "url";
import path from "path";
// vite.config.js
import PurgeIcons from "vite-plugin-purge-icons";
import Unfonts from "unplugin-fonts/vite";
export default defineConfig({
plugins: [
PurgeIcons({
content: ["./templates/*.html"],
}),
Unfonts({
custom: {
/**
* Fonts families lists
*/
families: [
{
/**
* Name of the font family.
*/
name: "Meslo LG",
/**
* Local name of the font. Used to add `src: local()` to `@font-rule`.
*/
local: "Meslo LG S",
/**
* Regex(es) of font files to import. The names of the files will
* predicate the `font-style` and `font-weight` values of the `@font-rule`'s.
*/
src: "./src/assets/fonts/meslo-LG/MesloLGS-Regular.ttf",
},
],
/**
* Defines the default `font-display` value used for the generated
* `@font-rule` classes.
*/
display: "auto",
/**
* Using `<link rel="preload">` will trigger a request for the WebFont
* early in the critical rendering path, without having to wait for the
* CSSOM to be created.
*/
preload: true,
/**
* Using `<link rel="prefetch">` is intended for prefetching resources
* that will be used in the next navigation/page load
* (e.g. when you go to the next page)
*
* Note: this can not be used with `preload`
*/
prefetch: false,
},
}),
],
build: {
outDir: fileURLToPath(new URL("./templates/assets/dist", import.meta.url)),
emptyOutDir: true,
lib: {
entry: path.resolve(__dirname, "src/main.ts"),
name: "main",
fileName: "main",
formats: ["iife"],
},
},
});