-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.ts
172 lines (164 loc) · 4.25 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
import fs from "node:fs";
import path from "node:path";
import locale from "@open-xamu-co/ui-common-helpers/es";
import packageJson from "./package.json" assert { type: "json" };
import {
debugCSS,
debugNuxt,
debugHTTPS,
production,
runtimeConfig,
countriesUrl,
} from "./resources/utils/enviroment";
/**
* Preload stylesheet and once loaded call them
* @param {string} href - Resource url
* @returns {object} Link object
*/
function getStyleSheetPreload(href: string) {
return {
rel: "preload",
as: "style" as const,
onload: "this.onload=null;this.rel='stylesheet'",
href,
};
}
const loaderCss = fs.readFileSync(path.resolve(__dirname, "assets/css/loader.css"), {
encoding: "utf8",
});
const css = ["@/assets/scss/base.scss"];
const stylesheets: string[] = [
"https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500;1,600&display=swap",
"https://unpkg.com/@fortawesome/fontawesome-free@^6/css/all.min.css",
"https://unpkg.com/sweetalert2@^11/dist/sweetalert2.min.css",
];
// compile on runtime when debuggin CSS
debugCSS ? css.push("@/assets/scss/vendor.scss") : stylesheets.push("/dist/vendor.min.css?k=1");
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: "2025-03-02",
devtools: {
enabled: debugNuxt,
timeline: { enabled: debugNuxt },
},
experimental: {
viewTransition: true,
},
app: {
keepalive: true,
pageTransition: { name: "page", mode: "out-in" },
layoutTransition: { name: "layout", mode: "out-in" },
head: {
htmlAttrs: { lang: "es" },
meta: [
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ name: "msvalidate.01", content: "BBF99508118DB02449397517DA5EAE5C" },
],
link: [
{ rel: "icon", type: "image/svg+xml", href: "/favicon.svg" },
{
rel: "preconnect",
href: "https://fonts.googleapis.com/",
crossorigin: "anonymous",
},
{ rel: "dns-prefetch", href: "https://fonts.googleapis.com/" },
{ rel: "preconnect", href: "https://unpkg.com/", crossorigin: "anonymous" },
{ rel: "dns-prefetch", href: "https://unpkg.com/" },
...stylesheets.map(getStyleSheetPreload),
],
style: [{ innerHTML: loaderCss }],
noscript: [{ innerHTML: "This app requires javascript to work" }],
},
},
devServer: { https: debugHTTPS && { key: "server.key", cert: "server.crt" } },
runtimeConfig,
nitro: {
preset: "firebase",
firebase: {
gen: 2,
httpsOptions: {
region: "us-east1",
maxInstances: 100,
memory: "2GiB",
timeoutSeconds: 300,
},
},
compressPublicAssets: true,
},
vite: {
server: { fs: { strict: "resolutions" in packageJson && !debugNuxt } },
resolve: { preserveSymlinks: true },
css: {
postcss: require("@open-xamu-co/ui-styles/postcss")[
production ? "production" : "development"
],
},
},
router: {
options: {
linkActiveClass: "is--route",
linkExactActiveClass: "is--routeExact",
scrollBehaviorType: "smooth",
},
},
routeRules: {
"/cursos": {
redirect: "/",
},
},
/** Global CSS */
css,
modules: [
"@pinia/nuxt",
"@pinia-plugin-persistedstate/nuxt",
"@open-xamu-co/ui-nuxt",
"@nuxt/scripts",
],
piniaPersistedstate: {
cookieOptions: {
sameSite: "strict",
maxAge: 365 * 24 * 60 * 60,
secure: production,
},
storage: "cookies",
},
xamu: {
locale,
lang: "es",
country: "co",
countriesUrl,
swal: {
overrides: {
customClass: {
confirmButton: ["bttn"],
cancelButton: ["bttnToggle"],
denyButton: ["link"],
},
},
preventOverrides: {
customClass: {
confirmButton: ["bttn", "--tm-danger-light"],
cancelButton: ["bttnToggle"],
denyButton: ["link"],
},
},
},
image: {
provider: "bypass",
domains: ["firebasestorage.googleapis.com"],
alias: { firebase: "/api/media/images" },
presets: { avatar: { modifiers: {} } },
providers: { bypass: { provider: "~/providers/bypass.ts" } },
},
imageHosts: ["lh3.googleusercontent.com"],
async logger(...args) {
if (import.meta.server) {
const { serverLogger } = await import("./server/utils/firebase");
return serverLogger(...args);
}
useLogger(...args);
},
},
scripts: { registry: { googleAnalytics: { id: "G-X7H48BMMRK" } } },
});