elearning/Frontend-Learner/nuxt.config.ts

84 lines
3.1 KiB
TypeScript

// Nuxt 3 + Quasar + Tailwind + TypeScript
// Configuration for E-Learning Platform - Refreshed
// ไฟล์ตั้งค่าหลักของ Nuxt.js ใช้สำหรับกำหนด Modules, Plugins, CSS และ Environment Variables
export default defineNuxtConfig({
// Modules ที่ใช้ในโปรเจกต์
// - nuxt-quasar-ui: สำหรับ UI Component Library (Quasar)
// - @nuxtjs/tailwindcss: สำหรับ Utility-first CSS Framework
// - @nuxtjs/i18n: สำหรับระบบหลายภาษา (Internationalization)
modules: ["nuxt-quasar-ui", "@nuxtjs/tailwindcss", "@nuxtjs/i18n"],
// การตั้งค่า i18n (ระบบภาษา)
i18n: {
strategy: 'no_prefix', // ไม่ใส่ prefix URL สำหรับภาษา default
defaultLocale: 'th', // ภาษาเริ่มต้นเป็นภาษาไทย
langDir: 'locales', // โฟลเดอร์เก็บไฟล์แปลภาษา
locales: [
{ code: 'th', name: 'ไทย', iso: 'th-TH', file: 'th.json' },
{ code: 'en', name: 'English', iso: 'en-US', file: 'en.json' }
],
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_redirected',
redirectOn: 'root'
}
},
// ไฟล์ CSS หลักของโปรเจกต์
css: ["~/assets/css/main.css"],
typescript: {
strict: true,
},
// การตั้งค่า Quasar Framework
quasar: {
extras: {
fontIcons: ["material-icons"],
},
plugins: ["Notify", "Dialog"], // เปิดใช้ Plugin Notify และ Dialog
config: {
brand: { // กำหนดชุดสีหลัก (Theme Colors)
primary: "#4b82f7",
secondary: "#2f5ed7",
accent: "#44d4a8",
dark: "#0f1827",
},
},
},
// กำหนดให้ Nuxt สแกน Components ในโฟลเดอร์ ~/components โดยอัตโนมัติ
components: [
{
path: "~/components",
pathPrefix: false, // เรียกใช้ Component ได้โดยไม่ต้องมี prefix ชื่อโฟลเดอร์
},
],
// การตั้งค่า HTML Head (Meta tags, Google Fonts)
app: {
head: {
htmlAttrs: {
lang: 'th',
},
title: "E-Learning System",
meta: [
{ name: "viewport", content: "width=device-width, initial-scale=1" },
],
link: [
{
rel: "stylesheet",
// โหลด Font: Inter, Prompt, Sarabun
href: "https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Prompt:wght@300;400;500;600;700;800;900&family=Sarabun:wght@300;400;500;600;700;800&family=Poppins:wght@300;400;500;600;700;800;900&display=swap",
},
],
},
},
// Environment Variables ที่ใช้ในโปรเจกต์ (เข้าถึงได้ทั้ง Server และ Client)
runtimeConfig: {
public: {
apiBase: process.env.NUXT_PUBLIC_API_BASE || 'http://localhost:4000/api'
}
}
});