-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.ts
56 lines (47 loc) · 1.45 KB
/
nuxt.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
// https://nuxt.com/docs/api/configuration/nuxt-config
import fs from "fs";
import path from "path";
const CUSTOM_ICON_DIR = "assets/icons";
const customIconsDir = path.resolve(__dirname, CUSTOM_ICON_DIR);
const customCollection = fs
.readdirSync(customIconsDir, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);
const generateCustomIconsArray = () => {
const rootIconFolder = {
prefix: "ci",
dir: `./${CUSTOM_ICON_DIR}`,
};
const childrenIconFolders = customCollection.map((dir) => ({
prefix: `ci-${dir}`,
dir: `./${CUSTOM_ICON_DIR}/${dir}`,
}));
return [rootIconFolder, ...childrenIconFolders];
};
export default defineNuxtConfig({
compatibilityDate: "2024-10-02",
devtools: { enabled: true },
vite: {
css: {
preprocessorOptions: {
scss: {
additionalData:
'@import "@/assets/scss/vars/index.scss"; @import "@/assets/scss/mixins/index.scss";',
},
},
},
},
css: ["@/assets/scss/main.scss"],
plugins: [
// '~/plugins/v-click-outside.js',
],
modules: ["@pinia/nuxt", "@nuxt/icon"],
icon: {
componentName: "NuxtIcon",
mode: "svg",
customCollections: generateCustomIconsArray(),
},
resolve: {
alias: [{ find: "@", replacement: path.resolve(__dirname, "./") }],
},
});